package com.handinfo.android.game;

import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Map;
import java.util.Vector;
import java.util.concurrent.CopyOnWriteArrayList;

import android.graphics.Bitmap;

import com.handinfo.android.DWGameActivity;
import com.handinfo.android.DWGameManager;
import com.handinfo.android.core.graphics.DWGraphics;
import com.handinfo.android.core.net.BaseConnection;
import com.handinfo.android.core.net.GameProtocol;
import com.handinfo.android.core.resource.ResHead;
import com.handinfo.android.game.item.Item;
import com.handinfo.android.game.item.ItemConstants;
import com.handinfo.android.game.item.ItemConsume;
import com.handinfo.android.game.item.MailItem;
import com.handinfo.android.ui.Soul;
import com.handinfo.android.ui.UIWindows;
import com.handinfo.android.ui.window.UIHook;
import com.handinfo.android.ui.window.UIRankWindow;
import com.handinfo.android.ui.window.UISocial;
import com.handinfo.android.uicontrols.DWControlsManager;
//import com.handinfo.android.utils.ChannelOperation;
import com.handinfo.android.utils.DWChannel;
import com.handinfo.android.utils.Tools;

public class GameMessage
{
	public GameMessage()
	{

	}

	/** 是否锁定网络 */
	// private boolean m_net_lock = false;

	public static final int NET_LOCK_SHOW_TIME = 15;// 显示时间

	public static final int 锁_默认 = 1000;
	public static final int 锁_邮件 = 1001;
	public static final int 锁_社交 = 1002;
	public static final int 锁_摇钱树 = 1003;
	public static final int 锁_家族 = 1004;
	public static final int 锁_队伍 = 1005;
	public static final int 锁_背包 = 1006;
	public static final int 锁_天工 = 1007;
	public static final int 锁_内丹 = 1008;
	public static final int 锁_任务 = 1009;
	public static final int 锁_副本 = 1010;
	public static final int 锁_天命 = 1011;
	public static final int 锁_宠物 = 1011;
	public static final int 锁_技能 = 1012;
	public static final int 锁_人物信息 = 1013;
	public static final int 锁_排行 = 1014;
	public static final int 锁_公告 = 1015;
	public static final int 锁_修理 = 1016;
	public static final int 锁_出售 = 1017;
	public static final int 锁_道具商城 = 1018;
	public static final int 锁_充值 = 1019;
	public static final int 锁_VIP特权 = 1020;
	public static final int 锁_领奖 = 1021;
	public static final int 锁_答题 = 1022;
	public static final int 锁_通缉 = 1023;
	public static final int 锁_师徒 = 1024;
	public static final int 锁_八卦炉 = 1025;
	public static final int 锁_炼魂 = 1025;
	public static final int 锁_塔式副本 = 1026;
	public static final int 锁_修罗杀场 = 1027;
	public static final int 锁_推荐 = 1028;

	public Hashtable<Integer, Long> m_operate_lock = new Hashtable<Integer, Long>();

	public void lockNetwork(Integer key)
	{
		if (key == null) {
			return;
		}
		if (!m_operate_lock.containsKey(key)) {
			Long time = System.currentTimeMillis();
			m_operate_lock.put(key, time);
		}
	}

	public boolean isNetLocked(Integer key)
	{
		if (m_operate_lock.containsKey(key)) {
			Tools.debugPrintln("网络" + key + "被锁定,无法发送信息!");
			return true;
		}
		return false;
	}

	public void unlockNetwork(Integer key)
	{
		m_operate_lock.remove(key);
	}

	public boolean ishaveNetLocked()
	{
		return m_operate_lock.isEmpty();
	}

	public void networkTimeLogic()
	{
		if (!ishaveNetLocked()) {
			long curtime = System.currentTimeMillis();
			Enumeration<Integer> en = m_operate_lock.keys();
			while (en.hasMoreElements()) {
				Integer it = en.nextElement();
				long recordtime = ((Long) m_operate_lock.get(it)).longValue();
				if ((curtime - recordtime) / 1000 >= NET_LOCK_SHOW_TIME) {
					m_operate_lock.remove(it);
				}
			}
		}
	}

	public void drawNetworkTime(DWGraphics g)
	{
	}

	public void drawNetworkIcon(DWGraphics g, Bitmap img, int x, int y,
			int index)
	{
		// int cx = g.getClipX();
		// int cy = g.getClipY();
		// int cw = g.getClipWidth();
		// int ch = g.getClipHeight();
		// g.setClip(x - (img.getWidth() >> 3), y - (img.getHeight() >> 1),
		// img.getWidth() >> 2, img.getHeight());
		// g.drawImage(img, x - (img.getWidth() >> 3) - index * (img.getWidth()
		// >> 2), y - (img.getHeight() >> 1), Tools.LEFT_TOP);
		// g.setClip(cx, cy, cw, ch);
	}

	// public void sendHeartBeat()
	// {
	// ByteArrayOutputStream baos = new ByteArrayOutputStream();
	// DataOutputStream dos = new DataOutputStream(baos);
	// try {
	// dos.writeLong(System.currentTimeMillis());
	// DWGameManager.getInstance().getConnection().sendMessage(BaseConnection2.DEST_GATEWAY,
	// 0, GameProtocol.CS_USER_REG, baos.toByteArray());
	// dos.close();
	// dos = null;
	// baos.close();
	// baos = null;
	// }
	// catch (IOException e) {
	// Tools.debug(e);
	// }
	// }
	/**
	 * 注册账号
	 *
	 * @param userID
	 * 注册次数
	 * @param ID
	 * 用户账号
	 * @param password
	 * 用户密码
	 * @param IMEI
	 * 手机唯一码
	 * @param model
	 * 手机型号
	 * @param mobileNO
	 * 手机号码
	 */
	public void sendUserLoginTONGYONG(String field)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			int channel = DWChannel.CHANNEL;
			String imei = DWGameActivity.instance.m_imei;
			String imsi = DWGameActivity.instance.m_imsi;
			String model = DWGameActivity.instance.m_model;
			String number = DWGameActivity.instance.m_number;
			Byte phoneType = DWGameActivity.instance.m_phoneType;
			dos.writeUTF(field);
			dos.writeInt(channel);
			dos.writeUTF(imei);
			dos.writeUTF(imsi);
			dos.writeUTF(model);
			dos.writeUTF(number);
			dos.writeByte(phoneType);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_GATEWAY, 0,
							GameProtocol.C_USER_LOGIN_TONGYONG, baos.toByteArray());
			Tools.debugPrintln("发送注册账号 : " + GameProtocol.C_USER_LOGIN_TONGYONG
					+ ",渠道ID : " + channel + ",手机唯一码 : " + imei + ",手机型号 : "
					+ model + ",手机号码 : " + number + "信号类型：" + phoneType);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}
	/**
	 * 客户端通知计费中心
	 */
	public void sendNOTIFY_BILLING(long rold_id, String field)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(rold_id);
			dos.writeUTF(field);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_GATEWAY, 0,
							GameProtocol.C_USER_LOGIN_TONGYONG, baos.toByteArray());
			Tools.debugPrintln("发送注册账号 : " + GameProtocol.C_USER_LOGIN_TONGYONG
					+" "+field);

			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}
	/**
	 * 客户端通知计费中心
	 */
	public void sendNOTIFY_BILLINGSMS(long rold_id, String field)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(rold_id);
			dos.writeUTF(field);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_GATEWAY, 0,
							GameProtocol.CS_COMMON_NOTIFY_BILLING, baos.toByteArray());
			Tools.debugPrintln("指令："+GameProtocol.CS_COMMON_NOTIFY_BILLING+"发送注册账号 : " +rold_id
					+" "+field);

			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 注册账号
	 *
	 * @param userID
	 * 注册次数
	 * @param ID
	 * 用户账号
	 * @param password
	 * 用户密码
	 * @param IMEI
	 * 手机唯一码
	 * @param model
	 * 手机型号
	 * @param mobileNO
	 * 手机号码
	 */
	public void sendUserLoginSIKAI(String uid)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			int channel = DWChannel.CHANNEL;
			String imei = DWGameActivity.instance.m_imei;
			String imsi = DWGameActivity.instance.m_imsi;
			String model = DWGameActivity.instance.m_model;
			String number = DWGameActivity.instance.m_number;
			Byte phoneType = DWGameActivity.instance.m_phoneType;
			dos.writeUTF(uid);
			dos.writeInt(channel);
			dos.writeUTF(imei);
			dos.writeUTF(imsi);
			dos.writeUTF(model);
			dos.writeUTF(number);
			dos.writeByte(phoneType);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_GATEWAY, 0,
							GameProtocol.C_USER_LOGIN_SIKAI, baos.toByteArray());
			Tools.debugPrintln("发送注册账号 : " + GameProtocol.C_USER_LOGIN_SIKAI
					+ ",渠道ID : " + channel + ",手机唯一码 : " + imei + ",手机型号 : "
					+ model + ",手机号码 : " + number + "信号类型：" + phoneType);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 注册账号
	 *
	 * @param userID
	 * 注册次数
	 * @param ID
	 * 用户账号
	 * @param password
	 * 用户密码
	 * @param IMEI
	 * 手机唯一码
	 * @param model
	 * 手机型号
	 * @param mobileNO
	 * 手机号码
	 */
	public void sendUserLogin360(String code)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			int channel = DWChannel.CHANNEL;
			String imei = DWGameActivity.instance.m_imei;
			String imsi = DWGameActivity.instance.m_imsi;
			String model = DWGameActivity.instance.m_model;
			String number = DWGameActivity.instance.m_number;
			Byte phoneType = DWGameActivity.instance.m_phoneType;
			dos.writeUTF(code);
			dos.writeInt(channel);
			dos.writeUTF(imei);
			dos.writeUTF(imsi);
			dos.writeUTF(model);
			dos.writeUTF(number);
			dos.writeByte(phoneType);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_GATEWAY, 0,
							GameProtocol.C_USER_LOGIN_360, baos.toByteArray());
			Tools.debugPrintln("发送注册账号 : " + GameProtocol.C_USER_LOGIN_SIKAI
					+ ",渠道ID : " + channel + ",手机唯一码 : " + imei + ",手机型号 : "
					+ model + ",手机号码 : " + number + "信号类型：" + phoneType);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 注册账号
	 *
	 * @param userID
	 * 注册次数
	 * @param ID
	 * 用户账号
	 * @param password
	 * 用户密码
	 * @param IMEI
	 * 手机唯一码
	 * @param model
	 * 手机型号
	 * @param mobileNO
	 * 手机号码
	 */
	public void sendUserLoginXiaoMi(String uid)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			int channel = DWChannel.CHANNEL;
			String imei = DWGameActivity.instance.m_imei;
			String imsi = DWGameActivity.instance.m_imsi;
			String model = DWGameActivity.instance.m_model;
			String number = DWGameActivity.instance.m_number;
			Byte phoneType = DWGameActivity.instance.m_phoneType;
			dos.writeUTF(uid);
			dos.writeInt(channel);
			dos.writeUTF(imei);
			dos.writeUTF(imsi);
			dos.writeUTF(model);
			dos.writeUTF(number);
			dos.writeByte(phoneType);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_GATEWAY, 0,
							GameProtocol.C_USER_LOGIN_XIAOMI, baos.toByteArray());
			Tools.debugPrintln("发送注册账号 : " + GameProtocol.C_USER_LOGIN_XIAOMI
					+ ",渠道ID : " + channel + ",手机唯一码 : " + imei + ",手机型号 : "
					+ model + ",手机号码 : " + number + "信号类型：" + phoneType);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 注册账号
	 *
	 * @param userID
	 * 注册次数
	 * @param ID
	 * 用户账号
	 * @param password
	 * 用户密码
	 * @param IMEI
	 * 手机唯一码
	 * @param model
	 * 手机型号
	 * @param mobileNO
	 * 手机号码
	 */
	public void sendUserLoginJY(String sessionid)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			int channel = DWChannel.CHANNEL;
			String imei = DWGameActivity.instance.m_imei;
			String imsi = DWGameActivity.instance.m_imsi;
			String model = DWGameActivity.instance.m_model;
			String number = DWGameActivity.instance.m_number;
			Byte phoneType = DWGameActivity.instance.m_phoneType;
			dos.writeUTF(sessionid);
			dos.writeInt(channel);
			dos.writeUTF(imei);
			dos.writeUTF(imsi);
			dos.writeUTF(model);
			dos.writeUTF(number);
			dos.writeByte(phoneType);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_GATEWAY, 0,
							GameProtocol.C_USER_LOGIN_JY, baos.toByteArray());
			Tools.debugPrintln("发送注册账号 : " + GameProtocol.C_USER_LOGIN_JY
					+ ",渠道ID : " + channel + ",手机唯一码 : " + imei + ",手机型号 : "
					+ model + ",手机号码 : " + number + "信号类型：" + phoneType);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 注册账号
	 *
	 * @param userID
	 * 注册次数
	 * @param ID
	 * 用户账号
	 * @param password
	 * 用户密码
	 * @param IMEI
	 * 手机唯一码
	 * @param model
	 * 手机型号
	 * @param mobileNO
	 * 手机号码
	 */
	public void sendUserLoginUC(String sessionid)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			int channel = DWChannel.CHANNEL;
			String imei = DWGameActivity.instance.m_imei;
			String imsi = DWGameActivity.instance.m_imsi;
			String model = DWGameActivity.instance.m_model;
			String number = DWGameActivity.instance.m_number;
			Byte phoneType = DWGameActivity.instance.m_phoneType;
			dos.writeUTF(sessionid);
			dos.writeInt(channel);
			dos.writeUTF(imei);
			dos.writeUTF(imsi);
			dos.writeUTF(model);
			dos.writeUTF(number);
			dos.writeByte(phoneType);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_GATEWAY, 0,
							GameProtocol.C_USER_LOGIN_UC, baos.toByteArray());
			Tools.debugPrintln("发送注册账号 : " + GameProtocol.C_USER_LOGIN_UC
					+ ",渠道ID : " + channel + ",手机唯一码 : " + imei + ",手机型号 : "
					+ model + ",手机号码 : " + number + "信号类型：" + phoneType);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 注册账号
	 *
	 * @param userID
	 * 注册次数
	 * @param ID
	 * 用户账号
	 * @param password
	 * 用户密码
	 * @param IMEI
	 * 手机唯一码
	 * @param model
	 * 手机型号
	 * @param mobileNO
	 * 手机号码
	 */
	public void sendUserLogin91(String uni, String sessionid)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			int channel = DWChannel.CHANNEL;
			String imei = DWGameActivity.instance.m_imei;
			String imsi = DWGameActivity.instance.m_imsi;
			String model = DWGameActivity.instance.m_model;
			String number = DWGameActivity.instance.m_number;
			Byte phoneType = DWGameActivity.instance.m_phoneType;
			dos.writeUTF(uni);
			dos.writeUTF(sessionid);
			dos.writeInt(channel);
			dos.writeUTF(imei);
			dos.writeUTF(imsi);
			dos.writeUTF(model);
			dos.writeUTF(number);
			dos.writeByte(phoneType);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_GATEWAY, 0,
							GameProtocol.C_USER_LOGIN_91, baos.toByteArray());
			Tools.debugPrintln("发送注册账号 : " + GameProtocol.C_USER_LOGIN_91
					+ "userName : " + uni + ",渠道ID : " + channel
					+ DWChannel.CHANNEL + ",手机唯一码 : " + imei + ",手机型号 : "
					+ model + ",手机号码 : " + number + "信号类型：" + phoneType);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 注册账号
	 *
	 * @param userID
	 * 注册次数
	 * @param ID
	 * 用户账号
	 * @param password
	 * 用户密码
	 * @param IMEI
	 * 手机唯一码
	 * @param model
	 * 手机型号
	 * @param mobileNO
	 * 手机号码
	 */
	public void sendUserLoginDL(String userName)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			int channel = DWChannel.CHANNEL;
			String imei = DWGameActivity.instance.m_imei;
			String imsi = DWGameActivity.instance.m_imsi;
			String model = DWGameActivity.instance.m_model;
			String number = DWGameActivity.instance.m_number;
			Byte phoneType = DWGameActivity.instance.m_phoneType;
			dos.writeUTF(userName);
			dos.writeInt(channel);
			dos.writeUTF(imei);
			dos.writeUTF(imsi);
			dos.writeUTF(model);
			dos.writeUTF(number);
			dos.writeByte(phoneType);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_GATEWAY, 0,
							GameProtocol.C_USER_LOGIN_DL, baos.toByteArray());
			Tools.debugPrintln("发送注册账号 : " + GameProtocol.C_USER_LOGIN_DL
					+ "userName : " + userName + ",渠道ID : " + channel
					+ DWChannel.CHANNEL + ",手机唯一码 : " + imei + ",手机型号 : "
					+ model + ",手机号码 : " + number + "信号类型：" + phoneType);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 用户中心 - 第一次认证,指令号为101
	 *
	 * @param name
	 * 用户名
	 * @param password
	 * 密码
	 * @param version
	 * 版本号
	 * @param Channel
	 * 渠道号
	 * @param FastInto
	 * 快速进入
	 */
	public void sendUserAuth(String name, String password, String version,
			int trench, int isFast)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			if (name == null)
			{
				name = "";
			}
			if (password == null)
			{
				password = "";
			}
			if (version == null)
			{
				version = "";
			}
			dos.writeUTF(name);// String 登录名
			dos.writeUTF(password);// String 密码
			dos.writeUTF(version);// byte 版本号
			dos.writeInt(trench);// 渠道号
			dos.writeByte(isFast);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_GATEWAY, 0,
							GameProtocol.CS_USER_AUTH, baos.toByteArray());
			Tools.debugPrintln("发送第一次认证 : " + GameProtocol.CS_USER_AUTH + " : "
					+ name + " : " + password + " : " + version + " : "
					+ trench + ";isFast=" + isFast);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 用户中心 - 重新认证,指令号为110
	 *
	 * @param name
	 * 用户名
	 * @param sessionID
	 * 会话ID
	 */
	public void sendUserReauth(String name, long sessionID)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(name);// String 登录名
			dos.writeLong(sessionID);// long 会话ID
			Tools.debugPrintln("name=" + name + ";sessionID=" + sessionID);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_GATEWAY, 0,
							GameProtocol.CS_USER_REAUTH, baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 获取角色列表, 指令号为104
	 */
	public void sendUserActorList()
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_GATEWAY, 0,
							GameProtocol.CS_USER_ROLE_LIST, baos.toByteArray());
			Tools.debugPrintln("发送获取角色列表 : " + GameProtocol.CS_USER_ROLE_LIST);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 获取服务器列表, 指令号为107
	 */
	public void sendUserServerList()
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_GATEWAY, 0,
							GameProtocol.CS_USER_SERVER_LIST,
							baos.toByteArray());
			Tools.debugPrintln("发送获取服务器列表 : "
					+ GameProtocol.CS_USER_SERVER_LIST);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 断开当前角色的其他连接
	 */
	public void sendUserDisconnectAnother()
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_GATEWAY, 0,
							GameProtocol.CS_USER_DISCONNECT_ANOTHER,
							baos.toByteArray());
			Tools.debugPrintln("发送断开其他连接 : "
					+ GameProtocol.CS_USER_DISCONNECT_ANOTHER);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 创建角色 , 指令号为105
	 *
	 * @param alias
	 * 名字
	 * @param Gender
	 * 性别 SEX_ALL = 0, //任意性别 MALE = 1, //男 FEMALE = 2,//女
	 * @param Job
	 * 职业 JOB_ALL = 0, //任意职业 JIAN_KE = 1, //剑客 WU_ZHE = 2, //武者
	 * DAO_SHI = 3,//斗士 JIAN_XIA = 4,//剑侠 JIAN_HAO = 5,//剑豪
	 * MENG_JIANG = 6,//猛将 DOU_SHI = 7, //斗士 FANG_SHI = 8, //方士
	 * SHU_SHI = 9, //术士 JIAN_SHEN = 10,//剑神 JIAN_MO = 11, //剑魔
	 * JIAN_SHENG= 12, //剑圣 ZHAN_KUANG = 13,//战狂 TIAN_JIANG = 14,
	 * //天将 WU_SHENG = 15,//武圣 YAN_LUO = 16, //阎罗 TIAN_SHI = 17, //天师
	 * DAO_SHENG = 18, //道圣
	 * @param Race
	 * RACE_ALL = 0, //任意 GOD = 1, //仙 GOBLIN = 2, //妖 HUMAN = 3, //人
	 * GHOST = 4,//鬼 realm 阵营
	 */
	public void sendUserCreateRole(String alias, byte Gender, byte Job,
			byte realm)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(alias);
			dos.writeByte(Gender);
			dos.writeByte(Job);
			dos.writeByte(realm);
			dos.writeInt(DWChannel.CHANNEL);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_GATEWAY, 0,
							GameProtocol.CS_USER_CREATE_ROLE,
							baos.toByteArray());
			debugPrintRole(alias, Gender, Job);
			Tools.debugPrintln("创建角色 : " + GameProtocol.CS_USER_CREATE_ROLE);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	private void debugPrintRole(String name, byte gender, byte job)
	{
		String[] genders = { "男", "女" };
		String[] jobs = { "剑客", "武者", "道士" };
		Tools.debugPrintln("玩家 : " + name + ", 性别 : " + genders[gender - 1]
				+ ", 职业 : " + jobs[job - 1]);
	}

	/**
	 * 选择角色, 指令号为111
	 *
	 * @param roleID
	 * 角色ID
	 */
	public void sendUserSelectRole(long roleID)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(roleID);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_GATEWAY, 0,
							GameProtocol.CS_USER_SELECT_ROLE,
							baos.toByteArray());
			Tools.debugPrintln("发送选择角色 : " + GameProtocol.CS_USER_SELECT_ROLE);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 角色信息
	 *
	 * @param roleID
	 */
	public void sendUserInformation(long roleID)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(roleID);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_USER_INFORMATION,
							baos.toByteArray());
			Tools.debugPrintln("发送角色信息 : " + GameProtocol.CS_USER_INFORMATION);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 场景信息
	 *
	 * @param roleID
	 */
	public void sendSceneInformation(long roleID)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(roleID);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_SCENE_INFORMATION,
							baos.toByteArray());
			Tools.debugPrintln("发送场景信息 : " + GameProtocol.CS_SCENE_INFORMATION);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 技能信息
	 *
	 * @param roleID
	 */
	public void sendUserSkillInformation(long roleID)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(roleID);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_USER_SKILL_INFORMATION,
							baos.toByteArray());
			Tools.debugPrintln("发送技能信息 : "
					+ GameProtocol.CS_USER_SKILL_INFORMATION);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);

		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 获取世界列表, 指令号为116
	 */
	// public void sendUserWorldList()
	// {
	// if (isNetLocked(锁_默认)) {
	// return;
	// }
	// ByteArrayOutputStream baos = new ByteArrayOutputStream();
	// DataOutputStream dos = new DataOutputStream(baos);
	// try {
	// DWGameManager.getInstance().getConnection().sendMessage(BaseConnection.DEST_GATEWAY,
	// 0,
	// GameProtocol.CS_USER_WORLD_LIST, baos.toByteArray());
	// Tools.debugPrintln("发送获取世界列表 : " + GameProtocol.CS_USER_WORLD_LIST);
	// dos.close();
	// dos = null;
	// baos.close();
	// baos = null;
	// lockNetwork(锁_默认);
	// }
	// catch (IOException e) {
	// Tools.debug(e);
	// }
	// }

	/**
	 * 删除角色， 指令号为119
	 *
	 * @param id
	 * 角色ID
	 */
	public void sendUserDeleteRole(long id)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(id);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_GATEWAY, 0,
							GameProtocol.CS_USER_DELETE_ROLE,
							baos.toByteArray());
			Tools.debugPrintln("发送删除角色 : " + GameProtocol.CS_USER_DELETE_ROLE);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 取消删除角色， 指令号为121
	 *
	 * @param id
	 * 角色ID
	 */
	public void sendUserFindRole(long id)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(id);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_GATEWAY, 0,
							GameProtocol.CS_USER_FIND_ROLE, baos.toByteArray());
			Tools.debugPrintln("发送取消删除角色 : " + GameProtocol.CS_USER_FIND_ROLE);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 注册账号
	 *
	 * @param userID
	 * 注册次数
	 * @param ID
	 * 用户账号
	 * @param password
	 * 用户密码
	 * @param IMEI
	 * 手机唯一码
	 * @param model
	 * 手机型号
	 * @param mobileNO
	 * 手机号码
	 */
	public void sendUserRegister(String ID, String password)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			int channel = DWChannel.CHANNEL;
			String imei = DWGameActivity.instance.m_imei;
			String imsi = DWGameActivity.instance.m_imsi;
			String model = DWGameActivity.instance.m_model;
			String number = DWGameActivity.instance.m_number;
			Byte phoneType = DWGameActivity.instance.m_phoneType;
			dos.writeUTF(ID);
			dos.writeUTF(password);
			dos.writeInt(channel);
			dos.writeUTF(imei);
			dos.writeUTF(imsi);
			dos.writeUTF(model);
			dos.writeUTF(number);
			dos.writeByte(phoneType);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_GATEWAY, 0,
							GameProtocol.CS_USER_REGISTER, baos.toByteArray());
			Tools.debugPrintln("发送注册账号 : " + GameProtocol.CS_USER_REGISTER
					+ ",Account : " + ID + ",password : " + password
					+ ",渠道ID : " + channel + DWChannel.CHANNEL + ",手机唯一码 : "
					+ imei + ",手机型号 : " + model + ",手机号码 : " + number + "信号类型："
					+ phoneType);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 快速注册
	 */
	public void sendUserAutoRegister()
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			int channel = DWChannel.CHANNEL;
			String imei = DWGameActivity.instance.m_imei;
			String imsi = DWGameActivity.instance.m_imsi;
			String model = DWGameActivity.instance.m_model;
			String number = DWGameActivity.instance.m_number;
			byte phoneType = DWGameActivity.instance.m_phoneType;
			dos.writeInt(DWChannel.CHANNEL);
			dos.writeUTF(imei);
			dos.writeUTF(imsi);
			dos.writeUTF(model);
			dos.writeUTF(number);
			dos.writeByte(phoneType);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_GATEWAY, 0,
							GameProtocol.CS_USER_AUTO_REGISTER,
							baos.toByteArray());

			Tools.debugPrintln("发送自动注册账号 : " + "渠道ID : " + channel + ",IMEI: "
					+ imei + ",IMSI: " + imsi + ",手机型号 : " + model + ",手机号码 : "
					+ number + ",信号类型：" + phoneType);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送进入世界
	 *
	 * @param id
	 */
	public void sendUserSelectWorld(int id)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeInt(id);
			Tools.debugPrintln("id=" + id);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_GATEWAY, 0,
							GameProtocol.CS_USER_SELECT_WORLD,
							baos.toByteArray());
			Tools.debugPrintln("发送进入世界 : " + GameProtocol.CS_USER_SELECT_WORLD
					+ "!");
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 修改密码
	 *
	 * @param account
	 * @param userID
	 * @param oldPassword
	 * @param newPassword
	 */
	public void sendUserChangePassword(String account, String oldPassword,
			String newPassword)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(account);
			dos.writeUTF(oldPassword);
			dos.writeUTF(newPassword);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_GATEWAY, 0,
							GameProtocol.CS_USER_CHANGE_PASSWORD,
							baos.toByteArray());
			Tools.debugPrintln("发送修改密码 : "
					+ GameProtocol.CS_USER_CHANGE_PASSWORD + "!账号 : " + account
					+ ",旧密码: " + oldPassword + ",新密码: " + newPassword);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送绑定手机号码
	 *
	 * @param id
	 */
	public void sendUserBinding(String account, String password, String phone,
			String email)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(account);
			dos.writeUTF(password);
			dos.writeUTF(phone);
			dos.writeUTF(email);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_GATEWAY, 0,
							GameProtocol.CS_USER_BINDING, baos.toByteArray());
			Tools.debugPrintln("发送账号绑定 : " + GameProtocol.CS_USER_BINDING
					+ "!账号 : " + account + ",密码 : " + password + ",手机 : "
					+ phone + ",邮箱 : " + email);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送解除绑定手机号码
	 *
	 * @param id
	 */
	public void sendUserUnbind(String account, String password)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(account);
			dos.writeUTF(password);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_GATEWAY, 0,
							GameProtocol.CS_USER_UNBIND, baos.toByteArray());
			Tools.debugPrintln("发送解除绑定 : " + GameProtocol.CS_USER_UNBIND
					+ "!账号 : " + account + ",密码 : " + password);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送找回密码
	 *
	 * @param id
	 */
	public void sendUserRetrievePassword(String phone, String email)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(phone);
			dos.writeUTF(email);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_GATEWAY, 0,
							GameProtocol.CS_USER_RETRIEVE_PASSWORD,
							baos.toByteArray());
			Tools.debugPrintln("发送找回密码 : "
					+ GameProtocol.CS_USER_RETRIEVE_PASSWORD + "!电话 : " + phone
					+ ",邮箱 : " + email);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送兑换
	 *
	 * @param key
	 */
	public void sendGiftBagExchange(String key, String state)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(key);
			dos.writeUTF(state);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_GIFT_BAG_EXCHANGE,
							baos.toByteArray());
			Tools.debugPrintln("发送兑换礼包 : " + GameProtocol.CS_GIFT_BAG_EXCHANGE
					+ " : " + key + "!礼包种类:" + state);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 角色移动, 指令号为3001
	 *
	 * @param point
	 * 拐点数量
	 * @param x
	 * 拐点x集合
	 * @param y
	 * 拐点y集合
	 * @param direct
	 * 拐点方向集合
	 */
	public void sendMove(ArrayList<Integer> point)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);

		try {
			dos.writeByte(point.size());
			for (int i = 0; i < point.size(); i++) {
				int info = point.get(i).intValue();
				int x = info & 0x0000ffff;
				int y = (info >> 16) & 0x0000ffff;
				dos.writeShort(x);
				dos.writeShort(y);
			}
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_SCENE_MOVE,
							baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 切换场景, 指令号3003
	 *
	 * @param id
	 * NPC ID
	 */
	public void sendChange(long id)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(id);
			Tools.debugPrintln("send change id -> " + id);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_SCENE_CHANGE,
							baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	public void sendChangeFinished()
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_SCENE_CHANGE_FINISHED,
							baos.toByteArray());
			Tools.debugPrintln("发送切换场景完成 : "
					+ GameProtocol.CS_SCENE_CHANGE_FINISHED);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送战斗同屏更新
	 *
	 * @param targetID
	 * 目标ID
	 * @param targetType
	 * 目标类型
	 * @param actionCount
	 * 动作序列
	 * @param ationID
	 * 动作ID列表
	 */
	public void sendBattleUpdate(int targetID, int targetType, int actionID)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeInt(targetID);
			dos.writeByte(targetType);
			dos.writeInt(actionID);
			Tools.debugPrintln("send battle -> " + targetID + " : "
					+ targetType + " : " + actionID);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_SCENE_BATTLE_UPDATE,
							baos.toByteArray());

			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	// /////////////////////////////////
	// x 组队
	// /////////////////////////////////
	/**
	 * 请求组队,邀请组队
	 *
	 * @param type
	 * 交互类型
	 * @param targetID
	 * 目标ID
	 */
	public void sendTeamRequest(long targetID)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			// if (DWGameManager.getInstance().m_role.m_teamID != 0) {
			// Vector vec = DWGameManager.getInstance().m_role.m_roleTeam;
			// for (int i = 0; i < vec.size(); i++) {
			// ActorRole role = (ActorRole) vec.elementAt(i);
			// if (role.m_gameID == targetID) {
			// return;
			// }
			// }
			// }
			dos.writeLong(targetID);
			Tools.debugPrintln("send request team -> " + targetID);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.CS_TEAM_REQUESTTEAM,
							baos.toByteArray());

			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 是否同意组队
	 *
	 * @param type
	 * //0：申请加入队伍1：邀请加入队伍
	 * @param targetID
	 * @param operateType
	 */
	public void sendisAgree(byte type, long targetID, byte operateType)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);

		try {
			dos.writeByte(type);
			dos.writeByte(operateType);
			Tools.debugPrintln("send isAgree team -> " + operateType);
			dos.writeLong(targetID);
			Tools.debugPrintln("send isAgree team -角色ID> " + targetID);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.CS_TEAM_ACCEPTTEAM, baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 退出组队 空指令
	 */
	public void sendQuitTeam()
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {

			Tools.debugPrintln("send quit team -> ");
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.CS_TEAM_QUITTEAM, baos.toByteArray());

			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 队长操作 （转让队长，踢出队员，解散队伍）
	 *
	 * @param type
	 * @param targetID
	 */
	public void sendLeaderHandle(byte type, long targetID, String name)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(type);
			dos.writeLong(targetID);
			dos.writeUTF(name);
			Tools.debugPrintln("send  leader handle-> " + type + " : "
					+ targetID);

			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.CS_TEAM_LEADERHANDLE,
							baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;

		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 查看附近队伍
	 */
	public void sendTeamNear()
	{

		if (isNetLocked(锁_队伍)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);

		try {
			Tools.debugPrintln("send teamNear-->");
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.CS_TEAM_TEAMNEAR, baos.toByteArray());

			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_队伍);
		}
		catch (IOException e) {
			Tools.debug(e);
		}

	}

	/**
	 * 自动组队
	 *
	 */
	public void sendTeamAutoCreate()
	{
		if (isNetLocked(锁_队伍)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);

		try {
			Tools.debugPrintln("send teamAutoCreate-->");
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.CS_TEAM_TEAMAUTOCREATE,
							baos.toByteArray());

			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_队伍);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 申请加入队伍
	 */
	public void sendTeamJoin(long teamID)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			if (DWGameManager.getInstance().m_role.m_teamID != 0) {
				return;
			}
			dos.writeLong(teamID);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.CS_TEAM_APPLYJOIN, baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 查看队伍信息
	 *
	 * @param type
	 */
	public void sendTeamAllMsg()
	{
		if (isNetLocked(锁_队伍)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.CS_TEAM_TEAMALLMSG, baos.toByteArray());
			Tools.debugPrintln("发送队伍列表请求 : " + GameProtocol.CS_TEAM_TEAMALLMSG);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_队伍);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 跟随队长
	 *
	 * @param type
	 * 跟随类型
	 * @param targetID
	 * 目标ID
	 */
	public void sendFollowLeader(byte type, int targetID)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(type);
			dos.writeInt(targetID);
			Tools.debugPrintln("send follow leader -> " + type + " : "
					+ targetID);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_TEAM_FOLLOWLEADER,
							baos.toByteArray());

			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 登入时 获得队伍信息
	 *
	 * @param teamID
	 */
	public void sendTeamFristLogin(long teamID)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(teamID);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.CS_TEAM_FIRSTLOGIN, baos.toByteArray());
			Tools.debugPrintln("发送队伍信息!");
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	// //////////////////////////////////////////////////////////////////////
	/**
	 * 开始上坐骑 byte 1 下坐骑 2上坐骑
	 *
	 * @param RideId
	 */
	public void sendRideStart(byte type, long RideId)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(type);
			dos.writeLong(RideId);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_RIDE_STARTRIDE,
							baos.toByteArray());
			Tools.debugPrintln("发送上坐骑请求 : " + GameProtocol.CS_RIDE_STARTRIDE
					+ " : " + RideId);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送完成上坐骑
	 */
	// public void sendRideOver()
	// {
	// ByteArrayOutputStream baos = new ByteArrayOutputStream();
	// DataOutputStream dos = new DataOutputStream(baos);
	// try {
	// DWGameManager.getInstance().getConnection().sendMessage(0,
	// GameProtocol.CS_RIDE_OVERRIDE, baos.toByteArray());
	// Tools.debugPrintln("发送完成上坐骑 : " + GameProtocol.CS_RIDE_OVERRIDE);
	// dos.close();
	// dos = null;
	// baos.close();
	// baos = null;
	// }
	// catch (IOException e) {
	// Tools.debug(e);
	// }
	// }

	/**
	 * 发送下坐骑
	 */
	// public void sendRideClose()
	// {
	// ByteArrayOutputStream baos = new ByteArrayOutputStream();
	// DataOutputStream dos = new DataOutputStream(baos);
	// try {
	// DWGameManager.getInstance().getConnection().sendMessage(0,
	// GameProtocol.CS_RIDE_CLOSERIDE, baos.toByteArray());
	// Tools.debugPrintln("发送下坐骑 : " + GameProtocol.CS_RIDE_CLOSERIDE);
	// dos.close();
	// dos = null;
	// baos.close();
	// baos = null;
	// }
	// catch (IOException e) {
	// Tools.debug(e);
	// }
	// }

	// ///////////////////////////////////////////////////////////////////
	/**
	 * 仇敌列表
	 */
	public void sendEnemyList(short page, short line)
	{
		if (isNetLocked(锁_社交)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeShort(page);
			dos.writeShort(line);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.CS_SOCIAL_ENEMY_ENEMYLIST,
							baos.toByteArray());
			Tools.debugPrintln("发送仇敌列表请求 : "
					+ GameProtocol.CS_SOCIAL_ENEMY_ENEMYLIST);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_社交);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 仇敌详细信息请求
	 *
	 * @param EnemyID
	 * @param EnemyName
	 */
	public void sendEnemyInfo(long EnemyID, String EnemyName)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(EnemyID);
			dos.writeUTF(EnemyName);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.CS_SOCIAL_ENEMY_ENEMYINFO,
							baos.toByteArray());
			Tools.debugPrintln("发送仇敌详细信息请求 : "
					+ GameProtocol.CS_SOCIAL_ENEMY_ENEMYINFO);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 仇敌具体位置请求
	 *
	 * @param EnemyID
	 */
	public void sendEnemyPosition(long EnemyID)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(EnemyID);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_WORLD, 0,
							GameProtocol.CS_SOCIAL_ENEMY_QUERY_POSITION,
							baos.toByteArray());
			Tools.debugPrintln("发送仇敌具体位置请求 : "
					+ GameProtocol.CS_SOCIAL_ENEMY_QUERY_POSITION);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 删除仇敌请求
	 *
	 * @param EnemyID
	 */
	public void sendEnemyDelete(long EnemyID)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(EnemyID);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.CS_SOCIAL_ENEMY_DELETE,
							baos.toByteArray());
			Tools.debugPrintln("发送删除仇敌请求 : "
					+ GameProtocol.CS_SOCIAL_ENEMY_DELETE);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发布通缉令
	 *
	 * @param EnemyID
	 * @param EnemyName
	 * @param moneyAward
	 * @param moneyAwardNum
	 * @param msg
	 */
	public void sendEnemyWanted(long EnemyID, String EnemyName,
			byte moneyAwardState, long moneyAwardNum)
	{
//		if (isNetLocked(锁_通缉)) {
//			return;
//		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(EnemyID);
			dos.writeUTF(EnemyName);
			dos.writeByte(moneyAwardState);
			dos.writeLong(moneyAwardNum);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_WORLD, 0,
							GameProtocol.CS_SOCIAL_ENEMY_WANTED_POSTER,
							baos.toByteArray());
			Tools.debugPrintln("发布通缉令请求 : "
					+ GameProtocol.CS_SOCIAL_ENEMY_WANTED_POSTER);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
//			lockNetwork(锁_通缉);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 锁定仇敌
	 *
	 * @param EnemyID
	 */
	public void sendEnemyLock(long EnemyID)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(EnemyID);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.CS_SOCIAL_ENEMY_LOCK,
							baos.toByteArray());
			Tools.debugPrintln("发送锁定仇敌请求 : "
					+ GameProtocol.CS_SOCIAL_ENEMY_LOCK);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	// //////////////////////////////////////////////////////////////////
	/**
	 * 发送列表请求
	 *
	 * @param type
	 */
	public void sendSocialList(byte type, int page, int num)
	{
		if (isNetLocked(锁_社交)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(type);
			dos.writeInt(page);
			dos.writeInt(num);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.CS_SOCIAL_LIST, baos.toByteArray());
			Tools.debugPrintln("发送社交列表请求 : " + GameProtocol.CS_SOCIAL_LIST
					+ " : " + type);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_社交);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送添加玩家
	 *
	 * @param type
	 * @param m_id_int
	 */
	public void sendSocialAdd(byte type, long id, String name)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(type);
			dos.writeLong(id);
			dos.writeUTF(name);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.CS_SOCIAL_ID_ADD, baos.toByteArray());
			Tools.debugPrintln("发送添加玩家类型 : " + type + ", ID : " + id
					+ ", name : " + name + ", 指令号 : "
					+ GameProtocol.CS_SOCIAL_ID_ADD);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送添加玩家
	 *
	 * @param type
	 * @param m_id_int
	 */
	public void sendSocialAddForName(byte type, String name)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(type);
			dos.writeUTF(name);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.CS_SOCIAL_NAME_ADD, baos.toByteArray());
			Tools.debugPrintln("发送添加玩家类型 : " + type + ", name : " + name
					+ ", 指令号 : " + GameProtocol.CS_SOCIAL_NAME_ADD);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送删除玩家
	 *
	 * @param type
	 * @param id
	 */
	public void sendSocialDelete(byte type, long id)
	{

		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(type);
			dos.writeLong(id);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.CS_SOCIAL_DELETE, baos.toByteArray());
			Tools.debugPrintln("发送删除玩家 : " + type + " , " + id);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 添加好友确认信息 0-不同意 1-同意
	 *
	 * @param result
	 * @param id
	 */
	public void sendSocialConfirmation(byte result, long id)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(result);
			dos.writeLong(id);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.CS_SOCIAL_CONFIRMATION,
							baos.toByteArray());
			Tools.debugPrintln("发送添加好友确认信息 : " + result + " , " + id);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 进入 摇钱树40002
	 *
	 * @param playerId
	 * 摇钱树所属玩家Id
	 */
	public void sendYQSInto(long playerId)
	{
		if (isNetLocked(GameMessage.锁_摇钱树)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(playerId);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.CS_DONGFU_INTO_DONGFU,
							baos.toByteArray());
			Tools.debugPrintln("进入摇钱树 : " + GameProtocol.CS_DONGFU_INTO_DONGFU);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(GameMessage.锁_摇钱树);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 摇钱树收获 应该收获的数量
	 */
	public void sendYQSReap(short num)
	{
		if (isNetLocked(GameMessage.锁_摇钱树)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeShort(num);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_DONGFU_REAP_DONGFU,
							baos.toByteArray());
			Tools.debugPrintln("摇钱树收获  " + GameProtocol.CS_DONGFU_REAP_DONGFU);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(GameMessage.锁_摇钱树);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/***
	 * 浇灌 40008
	 *
	 * @param id
	 */
	public void sendwatering(long id)
	{

		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);

		try {
			dos.writeLong(id); // 状态为1摇钱树的ID，状态为2玩家的ID
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.CS_DONGFU_WATERING, baos.toByteArray());
			Tools.debugPrintln("发送浇灌指令  ：" + GameProtocol.CS_DONGFU_WATERING);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送摇钱树好友列表请求
	 *
	 * @param type
	 */
	public void sendYQSFriendList(byte type, int page, int num)
	{
		if (isNetLocked(锁_社交)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(type);
			dos.writeInt(page);
			dos.writeInt(num);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.CS_YQS_FRIEND_LIST, baos.toByteArray());
			Tools.debugPrintln("发送社交列表请求 : " + GameProtocol.CS_YQS_FRIEND_LIST
					+ " : " + type);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_社交);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 查看NPC任务详细内容
	 *
	 * @param id
	 */
	public void sendNPCTaskView(String key)
	{
		if (isNetLocked(锁_任务)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);

		try {
			dos.writeUTF(key);// 任务id
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_TASK_NPC_VIEW,
							baos.toByteArray());
			Tools.debugPrintln("发送" + GameProtocol.CS_TASK_NPC_VIEW + "信息!");
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_任务);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 查看玩家任务详细内容
	 *
	 * @param id
	 */
	public void sendRoleTaskView(String key)
	{
		if (isNetLocked(锁_任务)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);

		try {
			dos.writeUTF(key);// 任务id
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_TASK_ROLE_VIEW,
							baos.toByteArray());
			Tools.debugPrintln("发送" + GameProtocol.CS_TASK_ROLE_VIEW + "信息!");
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_任务);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 完成任务
	 *
	 * @param id
	 */
	public void sendTaskFinish(String key)
	{
		if (isNetLocked(锁_任务)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(key);// 任务id
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_TASK_FINISH,
							baos.toByteArray());
			Tools.debugPrintln("发送" + GameProtocol.CS_TASK_FINISH + "信息!");
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_任务);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 接受任务发送
	 *
	 * @param id
	 */
	public void sendTaskBegin(String key)
	{
		if (isNetLocked(锁_任务)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(key);// 任务id
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_TASK_BEGIN,
							baos.toByteArray());
			Tools.debugPrintln("发送" + GameProtocol.CS_TASK_BEGIN + "信息!");
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_任务);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 放弃任务发送
	 *
	 * @param id
	 */
	public void sendTaskAbort(String key)
	{
		if (isNetLocked(锁_任务)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(key);// 任务id
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_TASK_ABORT,
							baos.toByteArray());
			Tools.debugPrintln("发送8004信息!");
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_任务);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 查看玩家任务列表
	 */
	public void sendTaskRoleList()
	{
		if (isNetLocked(锁_任务)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_TASK_ROLE_LIST,
							baos.toByteArray());
			Tools.debugPrintln("发送8100信息!");
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_任务);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 可接任务列表
	 */
	public void sendTaskacceptablyTaskList()
	{
		if (isNetLocked(锁_任务)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager.getInstance().getConnection().sendMessage(0,
					GameProtocol.CS_TASK_ACCEPTABLYTASKLIST, baos.toByteArray());
			Tools.debugPrintln("发送可接任务信息!  " + GameProtocol.CS_TASK_ACCEPTABLYTASKLIST);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_任务);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 请求道具详细信息
	 */
	// public void sendTaskTool(String key)
	// {
	// if (isNetLocked(锁_默认)) {
	// return;
	// }
	// ByteArrayOutputStream baos = new ByteArrayOutputStream();
	// DataOutputStream dos = new DataOutputStream(baos);
	// try {
	// dos.writeUTF(key);// 道具的key
	// DWGameManager.getInstance().getConnection().sendMessage(0,
	// GameProtocol.CS_TASK_TOOL, baos.toByteArray());
	// Tools.debugPrintln("发送111222333道具属性的信息!");
	// dos.close();
	// dos = null;
	// baos.close();
	// baos = null;
	// }
	// catch (IOException e) {
	// Tools.debug(e);
	// }
	// }

	/**
	 * 发送功能选项
	 *
	 * @param function
	 * 功能指令
	 * @param id
	 * 功能ID
	 */
	public void sendFunction(int function, String id)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(id);// 功能附带数据ID
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, function, baos.toByteArray());
			Tools.debugPrintln("发送" + function + "信息 Data ID : " + id);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送复活功能选项
	 *
	 * @param id
	 * 功能ID
	 */
	public void sendReviveFunction(int function)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, function, baos.toByteArray());
			Tools.debugPrintln("发送" + function + "信息!");
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送同意复活
	 *
	 * @param function
	 * 功能指令
	 * @param id
	 * 功能ID
	 */
	public void sendReviveAgree()
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_REVIVE_AGREE,
							baos.toByteArray());
			Tools.debugPrintln("发送" + GameProtocol.CS_REVIVE_AGREE + "信息!");
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 选择NPC
	 *
	 * @param npcId
	 * NPC的id
	 */
	public void sendNPCList(long npcId)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);

		try {
			Tools.debugPrintln("发送NPC列表请求!" + npcId);
			dos.writeLong(npcId);// 定义当前NpcId
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_NPC_LIST,
							baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送与NPC互动结束
	 */
	public void sendNPCInteractEnd(byte type)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(type);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_NPC_INTERACT_END,
							baos.toByteArray());
			Tools.debugPrintln("发送NPC互动结束" + GameProtocol.CS_NPC_INTERACT_END
					+ "!");
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送寻路指令
	 *
	 * @param String
	 * key
	 */
	public void sendScenePathfinding(String key)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(key);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_SCENE_PATHFINDING,
							baos.toByteArray());
			Tools.debugPrintln("发送寻路指令" + GameProtocol.CS_SCENE_PATHFINDING
					+ "! key : " + key);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送领取日常奖励指令
	 *
	 * @param String
	 * key
	 */
	public void sendGetRiChang(int index, byte status)
	{
//		if (isNetLocked(锁_默认)) {
//			return;
//		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeInt(index);
			dos.writeByte(status);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_ASSISTANT_EVERYDAY_JIANGLI,
							baos.toByteArray());
			Tools.debugPrintln("发送领取日常奖励指令" + GameProtocol.CS_ASSISTANT_EVERYDAY_JIANGLI);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
//			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	// /**
	// * 发送场景地图指令
	// */
	// public void sendSceneMap()
	// {
	// if (isNetLocked(锁_默认)) {
	// return;
	// }
	// ByteArrayOutputStream baos = new ByteArrayOutputStream();
	// DataOutputStream dos = new DataOutputStream(baos);
	// try {
	// DWGameManager.getInstance().getConnection().sendMessage(0,
	// GameProtocol.CS_SCENE_MAP, baos.toByteArray());
	// Tools.debugPrintln("发送场景地图指令" + GameProtocol.CS_SCENE_MAP + "!");
	// dos.close();
	// dos = null;
	// baos.close();
	// baos = null;
	// lockNetwork(锁_默认);
	// }
	// catch (IOException e) {
	// Tools.debug(e);
	// }
	// }

	/**
	 * 同屏更新请求缺失NPC
	 *
	 * @param id
	 * @param type
	 */
	public void sendSceneUpdateDeficiency(ArrayList<GameActor> list)
	{

		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			if (list != null) {
				dos.writeShort(list.size());
				for (int i = 0; i < list.size(); i++) {
					GameActor actor = (GameActor) list.get(i);
					dos.writeLong(actor.m_gameId);
					dos.writeByte(actor.m_type);
					Tools.debugPrintln("请求NPC ID : " + actor.m_gameId);
				}
			}
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.SC_SCENE_UPDATE_DEFICIENCY,
							baos.toByteArray());
			Tools.debugPrintln("发送NPC缺失"
					+ GameProtocol.SC_SCENE_UPDATE_DEFICIENCY + "!");
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 同屏角色视野（用于同屏范围）
	 *
	 * @param id
	 * @param type
	 */
	public void sendRoleSight(int range)
	{

		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeShort(range);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_ROLE_SIGHT,
							baos.toByteArray());
			Tools.debugPrintln("发送角色视野" + GameProtocol.CS_ROLE_SIGHT + "!");
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	// ////////////////////////////家族///////////////////////////////
	/**
	 * 验证是否可以创建家族
	 */
	public void sendFamilyVerify()
	{
		Tools.debugPrintln("发送指令?????" + GameProtocol.CS_FAMILY_VERIFY);
		if (isNetLocked(锁_家族)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_FAMILY_VERIFY,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_FAMILY_VERIFY);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_家族);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 创建家族
	 *
	 * @param name
	 */
	public void sendFamilyCreate(String name)
	{
		if (isNetLocked(锁_家族)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(name);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_FAMILY_CREATE,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_FAMILY_CREATE + " : "
					+ name);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_家族);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 申请加入家族
	 *
	 * @param id
	 */
	public void sendFamilyApplyAdd(long id)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(id);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.CS_FAMILY_APPLY_ADD,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_FAMILY_APPLY_ADD);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 通过家族名字加入家族
	 *
	 * @param id
	 */
	public void sendFamilyApplyAddName(String name)
	{
		if (isNetLocked(锁_家族)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(name);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.CS_FAMILY_APPLY_ADD_NAME,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_FAMILY_APPLY_ADD_NAME);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_家族);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 批准加入家族或者合并家族
	 *
	 * @param id
	 */
	public void sendFamilyRatifyAdd(byte type, long id, byte result)
	{
		if (isNetLocked(锁_家族)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(type);
			dos.writeLong(id);
			dos.writeByte(result);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.CS_FAMILY_RATIFY_ADD,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_FAMILY_RATIFY_ADD);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_家族);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 查看他人家族信息
	 */
	public void sendFamilyOtherMessage(long id)
	{
		if (isNetLocked(锁_家族)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(id);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.CS_FAMILY_OTHER_MESSAGE,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_FAMILY_OTHER_MESSAGE);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_家族);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送查看自己家族信息
	 */
	public void sendFamilyOwnMessage()
	{
		if (isNetLocked(锁_家族)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.CS_FAMILY_OWN_MESSAGE,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_FAMILY_OWN_MESSAGE);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_家族);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 修改家族宣言
	 *
	 * @param text
	 */
	public void sendFamilyModifyManifesto(String text)
	{
		if (isNetLocked(锁_家族)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(text);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.CS_FAMILY_MODIFY_MANIFESTO,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_FAMILY_MODIFY_MANIFESTO);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_家族);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 修改家族公告
	 *
	 * @param text
	 */
	public void sendFamilyModifyNotice(String text)
	{
		if (isNetLocked(锁_家族)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(text);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.CS_FAMILY_MODIFY_NOTICE,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_FAMILY_MODIFY_NOTICE);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_家族);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 查看家族申请列表
	 *
	 * @param page
	 * @param amountPage
	 * 每页 总数
	 */
	public void sendFamilyApplyList(short page, short amountPage)
	{
		if (isNetLocked(锁_家族)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeShort(page);
			dos.writeShort(amountPage);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.CS_FAMILY_APPLY_LIST,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_FAMILY_APPLY_LIST);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 查看家族成员列表
	 *
	 * @param page
	 * @param amountPage
	 * 每页总数
	 */
	public void sendFamilyMemberList(short page, short amountPage)
	{
		if (isNetLocked(锁_家族)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeShort(page);
			dos.writeShort(amountPage);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.CS_FAMILY_MEMBER_LIST,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_FAMILY_MEMBER_LIST);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 通过名字邀请加入家族
	 *
	 * @param name
	 */
	public void sendFamilyInviteAddName(String name)
	{

		if (isNetLocked(锁_家族)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(name);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.CS_FAMILY_INVITE_ADD_NAME,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_FAMILY_INVITE_ADD_NAME);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_家族);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 通过ID邀请加入家族
	 *
	 * @param name
	 */
	public void sendFamilyInviteAddID(long ID)
	{
		if (isNetLocked(锁_家族)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(ID);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.CS_FAMILY_INVITE_ADD_ID,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_FAMILY_INVITE_ADD_ID);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_家族);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	// /**
	// * 申请离开家族
	// */
	// public void sendFamilyApplyLeave() {
	// if (lockNetwork()) {
	// return;
	// }
	// ByteArrayOutputStream baos = new ByteArrayOutputStream();
	// DataOutputStream dos = new DataOutputStream(baos);
	// try {
	// DWGameManager.getInstance().getConnection().sendMessage(
	// BaseConnection.DEST_UNIVERSE, 0, GameProtocol.CS_FAMILY_APPLY_LEAVE,
	// baos.toByteArray());
	// Tools.debugPrintln("发送指令" + GameProtocol.CS_FAMILY_APPLY_LEAVE);
	// dos.close();
	// dos = null;
	// baos.close();
	// baos = null;
	// } catch (IOException e) {
	// Tools.debug(e);
	// }
	// }
	/**
	 * 确认离开家族
	 */
	public void sendFamilyConfirmLeave()
	{
		if (isNetLocked(锁_家族)) {
			return;
		}
		lockNetwork(锁_家族);
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.CS_FAMILY_CONFIRM_LEAVE,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_FAMILY_CONFIRM_LEAVE);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_家族);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送开除成员
	 */
	public void sendFamilyExpel(long id)
	{
		if (isNetLocked(锁_家族)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(id);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.CS_FAMILY_EXPEL, baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_FAMILY_EXPEL);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_家族);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送解散家族
	 */
	public void sendFamilyDismiss()
	{
		if (isNetLocked(锁_家族)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.CS_FAMILY_DISMISS, baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_FAMILY_DISMISS);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_家族);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送取消解散家族
	 */
	public void sendFamilyCancelDismiss()
	{
		if (isNetLocked(锁_家族)) {
			return;
		}
		lockNetwork(锁_家族);
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.CS_FAMILY_CANCEL_DISMISS,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_FAMILY_CANCEL_DISMISS);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_家族);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送确认被邀请入族
	 *
	 * @param confirm
	 * @param inviteID
	 * @param familyID
	 */
	public void sendFamilyInviteeAdd(byte confirm, long inviteID, long familyID)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(confirm);
			dos.writeLong(inviteID);
			dos.writeLong(familyID);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.CS_FAMILY_INVITEE_ADD,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_FAMILY_INVITEE_ADD
					+ " : " + confirm);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 设置长老
	 *
	 * @param type
	 * 类型0提升, 1免职
	 * @param memberID
	 * 玩家ID
	 */
	public void sendFamilySetElder(byte type, long memberID)
	{
		if (isNetLocked(锁_家族)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(type);
			dos.writeLong(memberID);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.CS_FAMILY_SET_ELDER,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_FAMILY_SET_ELDER
					+ " : " + type + " : " + memberID);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_家族);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 禅让族长
	 *
	 * @param id
	 * 成员ID
	 */
	public void sendFamilyDemiseSheikh(long id)
	{
		if (isNetLocked(锁_家族)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(id);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.CS_FAMILY_DEMISE_SHEIKH,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_FAMILY_DEMISE_SHEIKH
					+ " : " + id);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_家族);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 申请合并家族
	 *
	 * @param familyName
	 */
	public void sendFamilyApplyMerge(String familyName)
	{
		if (isNetLocked(锁_家族)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(familyName);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_FAMILY_APPLY_MERGE,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_FAMILY_APPLY_MERGE
					+ " : " + familyName);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_家族);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 家族捐献物资
	 *
	 * @param keys
	 * @param amount
	 */
	public void sendFamilyDonate(short amount, String[] keys, int[] num)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeShort(amount);
			for (int i = 0; i < amount; i++) {
				dos.writeUTF(keys[i]);
				dos.writeInt(num[i]);
				Tools.debugPrintln("捐献物资第" + i + "个key : " + keys[i]
						+ ", num : " + num[i]);
			}
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_FAMILY_DONATE,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_FAMILY_DONATE + "!");
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 家族抽奖开启
	 *
	 * @param keys
	 * @param amount
	 */
	public void sendFamilyLuckyOpen()
	{
		if (isNetLocked(锁_家族)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.CS_FAMILY_LUCKY_OPEN,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_FAMILY_LUCKY_OPEN + "!");
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 家族抽奖获取结果
	 *
	 * @param keys
	 * @param amount
	 */
	public void sendFamilyLuckyResult()
	{
		if (isNetLocked(锁_家族)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_FAMILY_LUCKY_RESULT,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_FAMILY_LUCKY_RESULT
					+ "!");
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_家族);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 获取家族列表
	 * @param page
	 * @param amountPage
	 */
	public void sendFamilyList(short page, short amountPage)
	{
		if (isNetLocked(锁_家族)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeShort(page);
			dos.writeShort(amountPage);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0, GameProtocol.CS_FAMILY_FAMILYLIST,
							baos.toByteArray());
			Tools.debugPrintln("查看家族列表：" + GameProtocol.CS_FAMILY_FAMILYLIST
					+ "!");
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_家族);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 家族技能
	 *
	 * @param keys
	 * @param amount
	 */
	public void sendFamilLookSkill()
	{
		if (isNetLocked(锁_家族)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_FAMILY_LOOKSKILL,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_FAMILY_LOOKSKILL
					+ "!");
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_家族);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}
	/**
	 * 家族技能
	 *
	 * @param keys
	 * @param amount
	 */
	public void sendFamilLookSkillAgain()
	{
		if (isNetLocked(锁_家族)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_FAMILY_LOOKSKILLAGAIN,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_FAMILY_LOOKSKILLAGAIN
					+ "!");
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_家族);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送世界地图切换
	 *
	 * @param keys
	 * @param amount
	 */
	public void sendSceneTransfer(String key)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(key);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_SCENE_TRANSFER,
							baos.toByteArray());
			Tools.debugPrintln("发送世界地图切换指令" + GameProtocol.CS_SCENE_TRANSFER
					+ ", key : " + key);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	// ////////////////////////////战场///////////////////////////////
	/**
	 * 发送加入战场队列
	 *
	 * @param key
	 * @param type
	 * @param id
	 */
	public void sendBattlefieldJoinQueue(String key, byte type, long id)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(key);
			dos.writeByte(type);
			dos.writeLong(id);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_INS, 0,
							GameProtocol.CS_BATTLEFIELD_JOIN_QUEUE_ASSIGN,
							baos.toByteArray());
			Tools.debugPrintln("发送指令"
					+ GameProtocol.CS_BATTLEFIELD_JOIN_QUEUE_ASSIGN + "!");
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 进入战场
	 */
	public void sendBattlefieldInto()
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_INS, 0,
							GameProtocol.CS_BATTLEFIELD_INTO,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_BATTLEFIELD_INTO + "!");
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 离开战场
	 */
	public void sendBattlefieldExit()
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_INS, 0,
							GameProtocol.CS_BATTLEFIELD_EXIT,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_BATTLEFIELD_EXIT + "!");
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	// ////////////////////////////战场///////////////////////////////
	/**
	 * 开启副本界面
	 */
	public void sendGameCarbonOpen()
	{
		if (isNetLocked(锁_副本)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_GAMECARBON_OPEN,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_GAMECARBON_OPEN + "!");
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_副本);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 副本自动组队
	 */
	public void sendGameCarbonAuto(String key)
	{
		if (isNetLocked(锁_副本)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(key);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_GAMECARBON_AUTO,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_GAMECARBON_AUTO + "!");
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_副本);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 立即进入副本
	 */
	public void sendGameCarbonInto(String key)
	{
		if (isNetLocked(锁_副本)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(key);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_GAMECARBON_INTO,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_GAMECARBON_INTO + "!");
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_副本);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 检测进入副本资格
	 */
	public void sendGameCarbonCheck(String key)
	{
		if (isNetLocked(锁_副本)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(key);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_GAMECARBON_CHECK,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_GAMECARBON_CHECK + "!");
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_副本);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 取消副本自动组队
	 */
	public void sendGameCarbonExit(String key)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(key);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_GAMECARBON_EXIT,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_GAMECARBON_EXIT + "!");
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 增加副本次数
	 */
	public void sendGameCarbonAdd(String key)
	{
		if (isNetLocked(锁_副本)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(key);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_GAMECARBON_ADD,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_GAMECARBON_ADD + "!");
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_副本);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送开启宝箱
	 *
	 * @param boxIndex
	 * 宝箱的下标 1 2 3
	 */
	public void sendGameCarbonOpenBox(byte boxIndex)
	{
		if (isNetLocked(锁_副本)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(boxIndex);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_GAMECARBON_OPEN_BOX,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_GAMECARBON_OPEN_BOX
					+ "!");
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_副本);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 离开副本
	 */
	public void sendGameCarbonQuit()
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_GAMECARBON_QUIT,
							baos.toByteArray());
			Tools.debugPrintln("发送指令离开副本" + GameProtocol.CS_GAMECARBON_QUIT
					+ "!");
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			UIWindows.getInstance().m_fuben.m_jingli_textbox
					.setText(Integer.toString(DWGameManager.getInstance().m_role.m_jinglizhi_shengyu));
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送副本详情
	 */
	public void sendGameCarbonReward_DetailS(String key)
	{
		if (isNetLocked(锁_副本)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(key);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_GAMECARBON_REWARD_DETAILS,
							baos.toByteArray());
			Tools.debugPrintln("发送指令副本详情："
					+ GameProtocol.CS_GAMECARBON_REWARD_DETAILS + "!");
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_副本);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送购买精力
	 */
	public void sendGameCarbonGVim(int num)
	{
		if (isNetLocked(锁_副本)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeInt(num);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_GAMECARBON_G_VIM,
							baos.toByteArray());
			Tools.debugPrintln("发送指令副本购买精力：" + GameProtocol.CS_GAMECARBON_G_VIM
					+ "!");
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_副本);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	//发送通缉榜翻页指令
	/**
	 * @param type排序
	 * @param ye页码
	 * @param tiaoshu显示条数
	 */
	public void sendDuelTongji(byte type, short ye, short tiaoshu)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(type);
			dos.writeShort(ye);
			dos.writeShort(tiaoshu);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_WANTED_FILP,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_WANTED_FILP + "!");
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	////////////////////////////////答题////////////////////////////
	public void sendDuelAnswerGetinto(long id)
	{
		if (isNetLocked(锁_答题)) {
			return;
		}

		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(id);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.SC_ANSWER_Confirmation1,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.SC_ANSWER_Confirmation1 + "!");
			dos.close();
			dos = null;
			baos.close();
			baos = null;

			lockNetwork(锁_答题);
		}
		catch (IOException e) {
			Tools.debug(e);
		}

	}

	//二次确认时发送的指令
	public void sendDuelAnswerGetinto2(byte id)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(id);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.SC_ANSWER_ING,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.SC_ANSWER_ING + "!");
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	//答题中发送
	public void sendDuelAnswering(byte id, byte Answer)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(id);
			dos.writeByte(Answer);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.SC_ANSWER_ING,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.SC_ANSWER_ING + "!");
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	//每日领奖发送
	public void sendDuelMeiri()
	{

		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);

		try {
			dos.writeByte((byte) 0);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.SC_MEIRI_ING,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.SC_MEIRI_ING + "!");
		}
		catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}

	// ////////////////////////////切磋///////////////////////////////
	/**
	 * 发送请求决斗
	 *
	 * @param id
	 */
	public void sendDuelRequest(long id)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(id);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_DUEL_REQUEST,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_DUEL_REQUEST + "!");
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送回复是否同意决斗
	 *
	 * @param id
	 * @param result
	 * 0拒绝 1同意
	 */
	public void sendDuelConfirmation(long id, byte result)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(id);
			dos.writeByte(result);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_DUEL_CONFIRMATION,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_DUEL_CONFIRMATION + "!");
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	// //////////////////////////////////////////////////////////////
	// 曾光伟
	// //////////////////////////////////////////////////////////////

	/***************************************
	 * 气泡
	 ***************************************/
	/**
	 * 当前完成气泡对话需想服务器发送当前对话的Id
	 */
	public void sendInteractId(String id)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(id);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.C_INTERACT, baos.toByteArray());

		}
		catch (IOException e) {
			Tools.debug(e);
		}
		finally {
			try {
				dos.close();
			}
			catch (IOException e) {
			}
			dos = null;
			try {
				baos.close();
			}
			catch (IOException e) {
			}
			baos = null;
		}
	}

	/** 发送采集草木或金石 指令 */
	public void sendLearnCollectionInofs(String temp)
	{

		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(temp);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_LEARN_COLLECTION_OK,
							baos.toByteArray());
		}
		catch (IOException e) {
			// Tools.debug(e);
		}
		finally {
			try {
				dos.close();
			}
			catch (IOException e) {
			}
			dos = null;
			try {
				baos.close();
			}
			catch (IOException e) {
			}
			baos = null;
		}

	}

	/** 发送遗忘采集 指令 */
	public void sendForgetCollectionInofs(String temp)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(temp);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_FORGET_COLLECTION_OK,
							baos.toByteArray());
		}
		catch (IOException e) {
			// Tools.debug(e);
		}
		finally {
			try {
				dos.close();
			}
			catch (IOException e) {
			}
			dos = null;
			try {
				baos.close();
			}
			catch (IOException e) {
			}
			baos = null;
		}

	}

	/***************************************
	 * 修理道具
	 ***************************************/
	/**
	 * 修理装备背包中的道具
	 */
	public void sendNpcFixAllEquip()
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(1);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.SC_NPC_FIX_EQUIPS,
							baos.toByteArray());
		}
		catch (IOException e) {
			Tools.debug(e);
		}
		finally {
			try {
				dos.close();
			}
			catch (IOException e) {
			}
			dos = null;
			try {
				baos.close();
			}
			catch (IOException e) {
			}
			baos = null;
		}
	}

	/**
	 * 修理角色背包中的道具
	 */
	public void sendNpcFixAllBag()
	{

		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.SC_NPC_FIX_ALL,
							baos.toByteArray());
		}
		catch (Exception e) {
			// Tools.debug(e);
		}
		finally {
			try {
				dos.close();
			}
			catch (IOException e) {
			}
			dos = null;
			try {
				baos.close();
			}
			catch (IOException e) {
			}
			baos = null;
		}
	}

	/**
	 * 点击购买道具
	 *
	 * @param key
	 * @param num
	 */
	public void sendNpcShopBuy(byte moneyType, String key, int num)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);

		try {
			dos.writeByte(moneyType);
			dos.writeUTF(key);
			dos.writeInt(num);// 定义当前NpcId
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.SC_NPC_SHOP_BUY,
							baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 贩卖道具
	 *
	 * @param layer
	 * @param index
	 * @param num
	 */
	public void sendNpcShopSail(byte layer, int index, int num)
	{
		if (isNetLocked(锁_出售)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);

		try {
			dos.writeByte(layer);
			dos.writeInt(index);// 定义当前NpcId
			dos.writeInt(num);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.SC_NPC_SHOP_SAIL,
							baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_出售);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	// //////////////////////背包////////////////////////////
	/**
	 * 请求道具数据 某一层的所有信息
	 */
	public void sendActorItemInfos(byte type)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(type);
			int gameProtocolType = GameProtocol.CS_ACTORITEM_INFOS;
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, gameProtocolType, baos.toByteArray());
			Tools.debugPrintln("发送某一层背包请求数据!");
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 使用某背包格子道具
	 *
	 * @param index_item
	 */
	public void sendActorItemUse(byte type, int index_item)
	{
		// Tools.debugPrintln("使用道具 sendActorItemUse type = " + type +
		// " index = " + index_item);
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(type);
			dos.writeInt(index_item);
			int gameProtocolType = GameProtocol.CS_ACTORITEM_USE;
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, gameProtocolType, baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 销毁道具
	 *
	 * @param layer
	 * @param index_item
	 * @param num
	 */
	public void sendActorItemDestroy(byte layer, int index_item, int num)
	{
		// Tools.debugPrintln("销毁道具 sendActorItemDestroy layer = " + layer +
		// " index = " + index_item + " num = " + num);
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(layer);
			dos.writeInt(index_item);
			dos.writeInt(num);
			int gameProtocolType = GameProtocol.CS_ACTORITEM_DESTORY;
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, gameProtocolType, baos.toByteArray());

		}
		catch (IOException e) {
			Tools.debug(e);
		}
		finally {
			try {
				dos.close();
			}
			catch (IOException e) {
			}
			dos = null;
			try {
				baos.close();
			}
			catch (IOException e) {
			}
			baos = null;
		}
	}

	/**
	 * 拆分道具
	 *
	 * @param layer
	 * @param index_item
	 * @param num
	 */
	public void sendActorItemDisintegrate(byte layer, int index_item, int num)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(layer);
			dos.writeInt(index_item);
			dos.writeInt(num);
			int gameProtocolType = GameProtocol.CS_ACTORITEM_DISINTEGRATE;
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, gameProtocolType, baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 移动道具
	 *
	 * @param layer
	 * @param srcIndex
	 * @param destIndex
	 */
	public void sendActorItemMove(byte layer, int srcIndex, int destIndex)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(layer);
			dos.writeInt(srcIndex);
			dos.writeInt(destIndex);
			int gameProtocolType = GameProtocol.CS_ACTORITEM_MOVE;
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, gameProtocolType, baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 装备道具
	 *
	 * @param layer
	 * @param index_item
	 */
	public void sendActorItemEquip(byte layer, int index_item)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(layer);
			dos.writeInt(index_item);
			int gameProtocolType = GameProtocol.CS_ACTORITEM_EQUIP;
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, gameProtocolType, baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 卸载道具（从装备栏卸载到背包栏）
	 *
	 * @param layer
	 * @param index_item
	 */
	public void sendActorItemUninstall(byte layer, int index_item)
	{
		Tools.debugPrintln("卸载道具 sendActorItemUninstall layer = " + layer
				+ " index = " + index_item);
		if (isNetLocked(锁_默认)) {
			Tools.debugPrintln("网络锁定，不能发出卸载道具信息");
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(layer);
			dos.writeInt(index_item);
			int gameProtocolType = GameProtocol.CS_ACTORITEM_UNINSTALL;
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, gameProtocolType, baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 查看道具详情In Npc shop
	 */
	public void sendActorItemDetail(String key)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(key);
			int gameProtocolType = GameProtocol.CS_ACTORITEM_DETAIL_NPCSHOP;
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, gameProtocolType, baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 查看道具详情,装备对比
	 *
	 * @param layer
	 * @param index_item
	 */
	public void sendActorItemDetail(long guid)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(guid);
			int gameProtocolType = GameProtocol.CS_ACTORITEM_DETAIL;
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, gameProtocolType, baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	public void sendOtherRoleActorItemDetail(long roleId, long guid)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(roleId);
			dos.writeLong(guid);
			int gameProtocolType = GameProtocol.CS_ACTORITEM_DETAIL_OTHER;
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_GATEWAY, 0,
							gameProtocolType, baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 整理道具
	 *
	 * @param layer
	 * @param index_item
	 */
	public void sendActorItemTrim(byte layer)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(layer);
			int gameProtocolType = GameProtocol.CS_ACTORITEM_TRIM;
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, gameProtocolType, baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 扩容背包
	 *
	 * @param layer
	 */
	public void sendActorItemKuorong(byte layer)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(layer);
			int gameProtocolType = GameProtocol.CS_ACTORITEM_KUORONG;
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, gameProtocolType, baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	public void sendActorItemJieBang(Cell cell)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(cell.m_item.m_guid);
			int gameProtocolType = GameProtocol.CS_ACTORITEM_JIEBANG;
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, gameProtocolType, baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 背包开启数目
	 *
	 * @param layer
	 */
	public void sendActorItemNumOpen(byte layer)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(layer);
			int gameProtocolType = GameProtocol.CS_ACTORITEM_NUM_OPEN;
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, gameProtocolType, baos.toByteArray());
			Tools.debugPrintln("发送背包开启数量!");
		}
		catch (IOException e) {
		}
		finally {
			try {
				dos.close();
			}
			catch (IOException e) {
			}
			dos = null;
			try {
				baos.close();
			}
			catch (IOException e) {
			}
			baos = null;
		}
	}

	/**
	 * 合成
	 */
	public void sendActorItemHecheng(int index_actor, int num)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeInt(index_actor);
			dos.writeInt(num);
			int gameProtocolType = GameProtocol.CS_ACTORITEM_BAOSHI_HECHENG;
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, gameProtocolType, baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 镶嵌
	 */
	public void sendActorItemXiangqian(byte layer, int index_jewel,
			int index_good)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(layer);
			dos.writeInt(index_jewel);
			dos.writeInt(index_good);
			int gameProtocolType = GameProtocol.CS_ACTORITEM_BAOSHI_XIANGQIAN;
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, gameProtocolType, baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 提取
	 *
	 * @param layer
	 * @param m_index_dongfu_peifang
	 * @param color
	 * @param colorIndex
	 */
	public void sendActorItemTiqu(byte layer, int index_equip, byte color,
			int colorIndex)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(layer);
			dos.writeInt(index_equip);
			dos.writeByte(color);
			dos.writeInt(colorIndex);
			int gameProtocolType = GameProtocol.CS_ACTORITEM_NIZI_TIQU;
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, gameProtocolType, baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 普通提取宝石
	 *
	 * @param layer
	 * @param m_index_dongfu_peifang
	 * @param color
	 * @param colorIndex
	 */
	public void sendActorItemNorTiqu(byte layer, int index_equip)
	{
		sendActorItemTiqu(layer, index_equip, (byte) 0, 0);
	}

	public void sendActorItemQianghua(byte type, long guid)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(type);
			dos.writeLong(guid);
			int gameProtocolType = GameProtocol.CS_ACTORITEM_QIANGHUA;
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, gameProtocolType, baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	public void sendActorItemQianghua(long id_dest, long id_src)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(id_dest);
			dos.writeLong(id_src);
			int gameProtocolType = GameProtocol.CS_ACTORITEM_QIANGHUA_SPEC;
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, gameProtocolType, baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	public void sendActorItemQianghuaInfo(byte type, long guid)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(type);
			dos.writeLong(guid);
			int gameProtocolType = GameProtocol.CS_ACTORITEM_QIANGHUA_INFOS;
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, gameProtocolType, baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 2012-4-16 下午03:24:42 venizeng
	 *
	 * @param equip
	 */
	public void sendActorItemResolve(Cell cell)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(cell.m_item.m_guid);
			int gameProtocolType = GameProtocol.CS_ACTORITEM_RESOLVE;
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, gameProtocolType, baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/************* 交易 **************/
	public void sendDealRequest(long id_B)
	{
		if (id_B == DWGameManager.getInstance().m_role.m_gameId) {
			DWGameManager.getInstance().addSystemInfo(
					DWGameManager.SYSTEM_INFO_TYPE_B, "不能和自己交易");
			return;
		}
		// if (lockNetwork()) {//不管是否都发布此消息
		// Tools.debugPrintln("网络被锁定，不能发送与玩家交易指令");
		// return;
		// }
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(id_B);
			int gameProtocolType = GameProtocol.CS_DEAL_REQUEST;// 请交交易(玩家A向server发交易请求/server向A发起交易请求响应)
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, gameProtocolType, baos.toByteArray());
		}
		catch (IOException e) {

		}
		finally {
			try {
				dos.close();
			}
			catch (IOException e) {
			}
			dos = null;
			try {
				baos.close();
			}
			catch (IOException e) {
			}
			baos = null;
		}
	}

	// 0 成功，1失败
	public void sendDealResponse(byte response)
	{
		// if (lockNetwork()) {
		// return;
		// }
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(response);
			int gameProtocolType = GameProtocol.CS_DEAL_RESPONESE;// B to
			// Server响应交易连接请求，Server
			// to B 发送响应
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, gameProtocolType, baos.toByteArray());
		}
		catch (IOException e) {
			Tools.debug(e);
		}
		finally {
			try {
				dos.close();
			}
			catch (IOException e) {
			}
			dos = null;
			try {
				baos.close();
			}
			catch (IOException e) {
			}
			baos = null;
		}
	}

	public void sendDealLayupGoods(int index)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeInt(index);
			int gameProtocolType = GameProtocol.CS_DEAL_GOODS_LAYUP_SELF;// A/B将背包数据放到交易栏，server将A/B
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, gameProtocolType, baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	public void sendDealLaydownGoods(int index_deal)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeInt(index_deal);
			int gameProtocolType = GameProtocol.CS_DEAL_GOODS_LAYDOWN_SELF;// A/B将交易栏放到背包，server将A/B
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, gameProtocolType, baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	public void sendDealLayupMoney(long money)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(money);
			int gameProtocolType = GameProtocol.CS_DEAL_MONEY_SELF;// 放置金钱到交易处
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, gameProtocolType, baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	public void sendDealConfig()
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_DEAL_CONFIG,
							baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (Exception e) {
			Tools.debug(e);
		}
	}

	public void sendDealCancel()
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_DEAL_CANCEL,
							baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (Exception e) {
			Tools.debug(e);
		}
	}

	/**** 新邮件 *****/

	/**
	 * @exception 请求角色邮件信息
	 * */
	public void sendRequestRoleMails()
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			int gameProtocolType = GameProtocol.CS_REQUEST_ROLE_MAILS;// 暂定的协议类型
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							gameProtocolType, baos.toByteArray());
		}
		catch (Exception e) {
			Tools.debug(e);
		}
		finally {
			try {
				dos.close();
			}
			catch (IOException e) {
			}
			dos = null;
			try {
				baos.close();
			}
			catch (IOException e) {
			}
			baos = null;
		}
	}

	/**
	 * @exception 请求新邮件信息
	 * */
	public void sendRequestNewMails()
	{
		if (isNetLocked(锁_邮件)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			int gameProtocolType = GameProtocol.CS_REQUEST_NEW_MAILS;
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							gameProtocolType, baos.toByteArray());
			Tools.debugPrintln("发送指令：" + GameProtocol.CS_REQUEST_NEW_MAILS);
			lockNetwork(锁_邮件);
		}
		catch (Exception e) {
			Tools.debug(e);
		}
	}

	/**
	 * @exception 请求更改邮件状态为已读
	 * */
	public void sendChangeMailState(long id)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(id);
			int gameProtocolType = GameProtocol.CS_CHANGE_MAIL_STATE;
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							gameProtocolType, baos.toByteArray());
		}
		catch (Exception e) {
			Tools.debug(e);
		}
		finally {
			try {
				dos.close();
			}
			catch (IOException e) {
			}
			dos = null;
			try {
				baos.close();
			}
			catch (IOException e) {
			}
			baos = null;
		}
	}

	/**
	 * @exception 请求删除多条信息
	 * @param 邮件数组
	 * */
	public void sendRequestDeleteMails(CopyOnWriteArrayList<MailItem> array)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			short size = (short) array.size();
			Tools.debugPrintln("删除邮件的长度：" + size);
			dos.writeShort(size);
			for (int i = 0; i < size; i++) {
				MailItem item = array.get(i);
				dos.writeLong(item.m_id);
			}
			int gameProtocolType = GameProtocol.CS_REQUEST_DELETE_MAILS;
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							gameProtocolType, baos.toByteArray());
		}
		catch (Exception e) {
			Tools.debug(e);
		}
		finally {
			try {
				dos.close();
			}
			catch (IOException e) {
			}
			dos = null;
			try {
				baos.close();
			}
			catch (IOException e) {
			}
			baos = null;
		}
	}

	/**
	 * @exception 请求获取邮件附件
	 * */
	public void sendRequestGetAnnex(long id)
	{
		if (isNetLocked(锁_邮件)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(id);
			int gameProtocolType = GameProtocol.CS_REQUEST_GET_ANNEX;
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, gameProtocolType, baos.toByteArray());
			Tools.debugPrintln("发送指令：" + GameProtocol.CS_REQUEST_GET_ANNEX
					+ "成功。");
			lockNetwork(锁_邮件);
		}
		catch (Exception e) {
			Tools.debug(e);
		}
	}

	/**
	 * @exception 发送邮件
	 * @param 邮件
	 * @param 附件道具
	 */
	public void sendMail(MailItem mail)
	{
		if (isNetLocked(锁_邮件)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			String name;// 对方名字
			String title;
			String content;
			if (mail.m_recvName == null) {
				name = "";
			}
			else {
				name = mail.m_recvName;
			}
			dos.writeUTF(name);
			if (mail.m_title == null) {
				title = "";
			}
			else {
				title = mail.m_title;
			}
			dos.writeUTF(title);
			if (mail.m_content == null) {
				content = "";
			}
			else {
				content = mail.m_content;
			}
			dos.writeUTF(content);
			dos.writeLong(mail.m_money);
			if (mail.m_item == null) {
				dos.writeLong((long) 0);
				dos.writeShort(0);
			}
			else {
				dos.writeLong(mail.m_item.m_guid);
				dos.writeShort(mail.m_item.m_num);
			}

			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_SEND_MAIL,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_SEND_MAIL + "成功");
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_邮件);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/******
	 * 重新选择角色
	 */
	public void sendReSel()
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			int gameProtocolType = GameProtocol.C_USER_RESEL;// 暂定的协议类型
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_GATEWAY, 0,
							gameProtocolType, baos.toByteArray());
			Tools.debugPrintln("发送切换角色!");
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (Exception e) {
			Tools.debug(e);
		}
	}

	/****************/
	// 拍卖
	/****************/

	public void sendAuctionSearchClose()
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			int gameProtocolType = GameProtocol.C_AUCTION_SEARCH_CLOSE;// 暂定的协议类型
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							gameProtocolType, baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	public void sendAuctionReSearch(byte page)
	{
		sendAuctionSearch((byte) 1, page, (byte) 2, (byte) 2, (byte) 2,
				(byte) 2, null, 0, 0, null);
	}

	/**
	 * 搜索拍卖道具
	 */
	public void sendAuctionSearch(byte type, byte page, byte num_page_server,
			byte actorItemtype, byte actorItemSubType, byte rare,
			String sailer, int minLevel, int maxLevel, String goodName)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(type);
			switch (type) {
				case 0:
					dos.writeByte(page);
					dos.writeByte(num_page_server);
					dos.writeByte(actorItemtype);
					dos.writeByte(actorItemSubType);
					dos.writeByte(rare);
					dos.writeUTF(sailer);
					dos.writeInt(minLevel);
					dos.writeInt(maxLevel);
					dos.writeUTF(goodName);
					break;
				case 1:
					dos.writeByte(page);
					break;
			}
			int gameProtocolType = GameProtocol.C_AUCTION_SEARCH;// 暂定的协议类型
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							gameProtocolType, baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 拍卖项详情
	 *
	 * @param sailId
	 */
	public void sendAuctionDetail(long sailId)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(sailId);
			int gameProtocolType = GameProtocol.C_AUCTION_DETAIL;// 暂定的协议类型
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							gameProtocolType, baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 一口价
	 *
	 * @param sailId
	 * @param money
	 */
	public void sendAuctionYikou(long sailId)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(sailId);
			int gameProtocolType = GameProtocol.C_AUCTION_YIKOUJIA;// 暂定的协议类型
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							gameProtocolType, baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 撤消拍卖道具
	 *
	 * @param sailId
	 */
	public void sendAuctionCancel(long sailId)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(sailId);
			int gameProtocolType = GameProtocol.C_AUCTION_CANCEL;// 暂定的协议类型
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							gameProtocolType, baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 拍卖道具
	 *
	 * @param index
	 * @param num
	 * @param jinpai
	 * @param valueYikou
	 */
	public void sendAuctionSail(int index, int num, long jinpai, long valueYikou)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeInt(index);
			dos.writeInt(num);
			dos.writeLong(jinpai);
			dos.writeLong(valueYikou);
			int gameProtocolType = GameProtocol.CS_AUCTION_SAIL;// 暂定的协议类型
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, gameProtocolType, baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	// //////////////////////////////////////////////////////////////////////////
	// // 聊天相关

	/**
	 * 屏蔽聊天栏
	 */
	public void sendChatPingBi(byte type)
	{
		sendChatPindaoOperation(0, type);
	}

	/**
	 * 屏蔽聊天栏
	 */
	public void sendChatOpen(byte type)
	{
		sendChatPindaoOperation(1, type);
	}

	/**
	 * 屏蔽聊天栏
	 */
	private void sendChatPindaoOperation(int operation, byte type)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte((byte) operation);
			dos.writeByte(type);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.C_CHATITEM_PINDAO_OPERATION,
							baos.toByteArray());
		}
		catch (IOException e) {
			Tools.debug(e);
		}
		finally {
			try {
				dos.close();
			}
			catch (IOException e) {
			}
			dos = null;
			try {
				baos.close();
			}
			catch (IOException e) {
			}
			baos = null;
		}
		Tools.debugPrintln("发送私聊信息。");
	}

	/**
	 * 发送给地图的聊天信息 2012-3-9 上午10:42:45 venizeng
	 *
	 * @param content
	 */
	public void sendChatQu(String content)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(content);
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, GameProtocol.C_CHAT_QU, baos.toByteArray());
		}
		catch (IOException e) {
		}
		finally {
			try {
				dos.close();
			}
			catch (IOException e) {
			}
			dos = null;
			try {
				baos.close();
			}
			catch (IOException e) {
			}
			baos = null;
		}
	}

	/**
	 * 发送给家族的
	 *
	 * @param content
	 */
	public void sendChatFamily(String content)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(content);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.C_CHAT_FAMILY, baos.toByteArray());
		}
		catch (IOException e) {
			Tools.debug(e);
		}
		finally {
			try {
				dos.close();
			}
			catch (IOException e) {
			}
			dos = null;
			try {
				baos.close();
			}
			catch (IOException e) {
			}
			baos = null;
		}
	}

	/**
	 * 阵营喊话
	 *
	 * @param content
	 */
	public void sendChatRealm(String content)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(content);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.C_CHAT_REAML, baos.toByteArray());
			Tools.debugPrintln("阵营发送内容：" + content);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
		finally {
			try {
				dos.close();
			}
			catch (IOException e) {
			}
			dos = null;
			try {
				baos.close();
			}
			catch (IOException e) {
			}
			baos = null;
		}
	}

	/**
	 * 发送世界喊话
	 *
	 * @param content
	 */
	public void sendChatWorld(String content)
	{
		Tools.debugPrintln("发送世界喊话");
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(content);
			DWGameManager.getInstance().getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.C_CHAT_WORLD, baos.toByteArray());
		}
		catch (IOException e) {
		}
		finally {
			try {
				dos.close();
			}
			catch (IOException e) {
			}
			dos = null;
			try {
				baos.close();
			}
			catch (IOException e) {
			}
			baos = null;
		}
	}

	/**
	 * 全服喊话,使用喇叭#
	 *
	 * @param content
	 */
	public void sendChatWorldBySpeaker(long id, String content)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(content);
			dos.writeLong(id);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.C_CHAT_SERVER,
							baos.toByteArray());
			Tools.debugPrintln("发送世界喊话" + GameProtocol.C_CHAT_SERVER);
		}
		catch (IOException e) {
		}
		finally {
			try {
				dos.close();
			}
			catch (IOException e) {
			}
			dos = null;
			try {
				baos.close();
			}
			catch (IOException e) {
			}
			baos = null;
		}
	}

	/**
	 * 发送给队伍的
	 *
	 * @param content
	 */
	public void sendChatTeam(String content)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(content);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.C_CHAT_TEAM, baos.toByteArray());
		}
		catch (IOException e) {
		}
		finally {
			try {
				dos.close();
			}
			catch (IOException e) {
			}
			dos = null;
			try {
				baos.close();
			}
			catch (IOException e) {
			}
			baos = null;
		}
	}

	/**
	 * 私聊
	 *
	 * @param targedId
	 * 目标id
	 * @param content
	 * 内容
	 */
	public void sendChatItemCommitPrivate(long targedId, String content)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(targedId);
			dos.writeUTF(content);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.CS_CHATITEM_COMMIT_ID,
							baos.toByteArray());
		}
		catch (IOException e) {
		}
		finally {
			try {
				dos.close();
			}
			catch (IOException e) {
			}
			dos = null;
			try {
				baos.close();
			}
			catch (IOException e) {
			}
			baos = null;
		}
	}

	// ///通缉令相关
	/**
	 * 请求查看选中的通缉令信息
	 * */
	public void sendWantedSee(long guid)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(guid);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.CS_WANTED_SEE, baos.toByteArray());
			Tools.debugPrintln("发送技能信息 : " + GameProtocol.CS_WANTED_SEE);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 在通缉令中请求添加仇敌
	 * */
	public void sendWantedAddEnemy(long guid, String name)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(guid);
			dos.writeUTF(name);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.CS_WANTED_ADDENEMY, baos.toByteArray());
			Tools.debugPrintln("发送技能信息 : " + GameProtocol.CS_WANTED_ADDENEMY);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/** 请求系统公告 */
	public void sendAnnouncement()
	{
		if (isNetLocked(锁_公告)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_GAME_ANNOUNCEMENT,
							baos.toByteArray());
			Tools.debugPrintln("发送请求系统公告信息 : "
					+ GameProtocol.CS_GAME_ANNOUNCEMENT);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_公告);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/** 请求单元公告内容 */
	public void sendGameNoticeInfo(byte index)
	{
		if (isNetLocked(锁_公告)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(index);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_GAME_NOTICE_INFO,
							baos.toByteArray());
			Tools.debugPrintln("发送请求单元公告信息 : "
					+ GameProtocol.CS_GAME_NOTICE_INFO);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_公告);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 通缉令请求查看目标位置
	 * */
	public void sendChecTargetPosition(long guid, String name)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(guid);
			dos.writeUTF(name);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.CS_WANTED_TARGETPOSITION,
							baos.toByteArray());
			Tools.debugPrintln("发送技能信息 : "
					+ GameProtocol.CS_WANTED_TARGETPOSITION);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 通缉令请求排序和翻页
	 *
	 * @param byte 排序类型
	 * @param short 请求页数
	 * @param short 每页显示条数
	 * */
	public void sendWantedFilp(byte sortType, short page, short line)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(sortType);
			dos.writeShort(page);
			dos.writeShort(line);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.CS_WANTED_FILP, baos.toByteArray());
			Tools.debugPrintln("发送技能信息 : " + GameProtocol.CS_WANTED_FILP);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 通缉令我的发布请求与翻页
	 *
	 * @param short 请求页数
	 * @param short 每页显示条数
	 * */
	public void sendWantedMyPublishFilp(short page, short line)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeShort(page);
			dos.writeShort(line);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_UNIVERSE, 0,
							GameProtocol.CS_WANTED_MYPUBLISH,
							baos.toByteArray());
			Tools.debugPrintln("发送技能信息 : " + GameProtocol.CS_WANTED_MYPUBLISH);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 接通缉令
	 * */
	public void sendWantedRecv(long guid)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(guid);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_WANTED_RECV,
							baos.toByteArray());
			Tools.debugPrintln("发送技能信息 : " + GameProtocol.CS_WANTED_RECV);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	// //////////////////////////////////////////////////////////////////////////
	// // 战斗相关
	/**
	 * 初始化角色技能列表 ID：5200
	 */
	public void sendCombatSkillList()
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_COMBAT_SKILL_LIST,
							baos.toByteArray());
			Tools.debugPrintln("发送技能信息 : " + GameProtocol.CS_COMBAT_SKILL_LIST);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 学习技能 ID：5201
	 *
	 * @param skillId
	 */
	public void sendLearnCombatSkill(String id)
	{
		if (isNetLocked(锁_技能)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(id);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_LEARN_COMBAT_SKILL,
							baos.toByteArray());
			Tools.debugPrintln("发送学习技能指令:" + GameProtocol.CS_LEARN_COMBAT_SKILL
					+ " -- 技能Id:" + id);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_技能);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 激活技能 5202
	 *
	 * @param id
	 * @param index
	 */
	public void sendActiveCombatSkill(String id, int index)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(index);
			dos.writeUTF(id);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_ACTIVE_COMBAT_SKILL,
							baos.toByteArray());
			Tools.debugPrintln("发送激活技能技能指令:"
					+ GameProtocol.CS_ACTIVE_COMBAT_SKILL + " -- 技能Id:" + id);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 施放技能 ID:5204
	 *
	 * @param skillId
	 * @param targetId
	 */
	public void sendCastSkill(String id, long targetId)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(id);
			dos.writeLong(targetId);
			// long time = System.currentTimeMillis()
			// + DWGameManager.s_worldTimeDelay;
			// // Date data = new Date(time);
			// // System.out.println("发送战斗指令时间：" + data.toString());
			// dos.writeLong(time);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_CAST_SKILL,
							baos.toByteArray());
			Tools.debugPrintln("发送5204指令! 施放技能" + id);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 吟唱技能 ID:5207
	 *
	 * @param skillId
	 * @param targetId
	 */
	public void sendSingSkill(String id, long targetId)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(id);
			dos.writeLong(targetId);
			dos.writeLong(DWGameManager.s_worldTimeDelay);
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, GameProtocol.CS_SING, baos.toByteArray());
			Tools.debugPrintln("吟唱" + id + "--发送指令：" + GameProtocol.CS_SING);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 位移验证 指令号 5220
	 *
	 * @param skillId
	 * @param targetId
	 */
	public void sendCastSkillMove(short skillId, long targetId, int x, int y)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeShort(skillId);
			dos.writeLong(targetId);
			dos.writeInt(x);
			dos.writeInt(y);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_CAST_SKILL_MOVE,
							baos.toByteArray());
			Tools.debugPrintln("发送" + GameProtocol.CS_CAST_SKILL_MOVE + "指令!"
					+ skillId);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 吟唱中断 ID：5208
	 */
	public void sendSingInterrupt()
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_SING_INTERRUPT,
							baos.toByteArray());
			Tools.debugPrintln("发送吟唱中断指令！ 5208 ");
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	public void sendSkillDetail(short id_skill)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeShort(id_skill);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.SC_SKILL_DETAIL,
							baos.toByteArray());
			Tools.debugPrintln("发送5214指令!");
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	// 打开或关闭符咒开关
	public void sendControlSpell(byte _switch)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(_switch);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_CONTROL_SPELL,
							baos.toByteArray());
			Tools.debugPrintln("发送指令730");
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	// // 战斗相关
	// //////////////////////////////////////////////////////////////////////////

	// //////////////////////////////////////////////////////////////////////////
	// // 资源相关
	// public void sendRequestResource(ResHead res)
	// {
	// ByteArrayOutputStream baos = new ByteArrayOutputStream();
	// DataOutputStream dos = new DataOutputStream(baos);
	// try {
	// dos.writeShort(1);
	// dos.writeByte(res.m_type);
	// dos.writeUTF(res.m_url);
	// DWGameManager.getInstance().getConnection().sendMessage(BaseConnection.DEST_RES,
	// 0, GameProtocol.CS_REQUEST_RESOURCE, baos.toByteArray());
	// dos.close();
	// dos = null;
	// baos.close();
	// baos = null;
	// } catch (IOException e) {
	// Tools.debug(e);
	// }
	// }

	public void sendRequestResource(Map<String, ResHead> ress)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			int length = ress.size();
			dos.writeShort(length);
			for (ResHead res : ress.values()) {
				dos.writeByte(res.m_type);
				dos.writeUTF(res.m_url);
				Tools.debugPrintln("请求资源url:" + res.m_url);
			}

			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_RES, 0,
							GameProtocol.CS_REQUEST_RESOURCE,
							baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送当前客户端版本
	 *
	 * @param versions
	 * 版本号
	 */
	public void sendCurrentVersions(String versions, int channelId)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(versions);
			dos.writeInt(channelId);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_GATEWAY, 0,
							GameProtocol.CS_CHECK_VERSION, baos.toByteArray());
			Tools.debugPrintln("发送当前客户端版本: " + GameProtocol.CS_CHECK_VERSION);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送当前资源版本
	 *
	 * @param versions
	 * @param adpaterType
	 * @param adpaterValue
	 * 版本号
	 */
	public void sendCurrentResourceVersions(String versions, byte adpaterType, byte adpaterValue, byte halfRes)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(versions);
			dos.writeByte(adpaterType);
			dos.writeByte(adpaterValue);
			dos.writeByte(halfRes);
			Tools.debugPrintln("发送当前资源版本： " + versions + ";适配类型：" + adpaterType + ";适配值：" + adpaterValue + ";是否请求补充资源："
					+ halfRes);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_RES, 0,
							GameProtocol.C_REQUEST_CURRENT_VERSIONS,
							baos.toByteArray());
			Tools.debugPrintln("发送当前资源版本： "
					+ GameProtocol.C_REQUEST_CURRENT_VERSIONS);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 请求 zip包
	 *
	 * @param key
	 * @param pos
	 */
	public void sendResourceRequestZip(String key, int pos)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(key);
			dos.writeInt(pos);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_RES, 0,
							GameProtocol.C_RES_ZIP_UPDATA, baos.toByteArray());
			Tools.debugPrintln("发送当前 zip： " + GameProtocol.C_RES_ZIP_UPDATA);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	// // 资源相关
	// //////////////////////////////////////////////////////////////////////////

	/**
	 * 发送拾取道具
	 *
	 * @param id
	 */
	public void sendPickUpItem(long id)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(id);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_PICKUP_ITEM,
							baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送结束动画 559
	 */
	public void sendEndTrailer()
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_END_TRAILER,
							baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 设置角色坐标（脚本动画中用）
	 *
	 * @param x
	 * @param y
	 */
	public void sendSetPosition(int x, int y)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeShort(x);
			dos.writeShort(y);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_SCRIPT_SET_POSITION,
							baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 切换场景（脚本动画中用）
	 *
	 * @param sceneKey
	 * @param x
	 * @param y
	 */
	public void sendSwitchScene(String sceneKey, int x, int y)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(sceneKey);
			dos.writeShort(x);
			dos.writeShort(y);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_SCRIPT_SWITCH_SCENE,
							baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 脱离卡死，服务器不回推 2012-3-27 下午03:35:36 venizeng
	 */
	public void sendUserTuoli()
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.S_USER_TUOLI,
							baos.toByteArray());
		}
		catch (Exception e) {
			// Tools.debug(e);
		}
		finally {
			try {
				dos.close();
			}
			catch (IOException e) {
			}
			dos = null;
			try {
				baos.close();
			}
			catch (IOException e) {
			}
			baos = null;
		}
	}

	/**
	 * 请求打开每日任务界面
	 */
	public void sendOpenActivity()
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_OPEN_ACTIVITY_WINDOW,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_OPEN_ACTIVITY_WINDOW);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 请求打开活动中副本活动界面
	 * */
	public void sendOpenFBActivity()
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_OPEN_FB_ACTIVITY_WINDOW,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_OPEN_FB_ACTIVITY_WINDOW);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	public void sendMustJion()
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_FB_MUST_JION,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_FB_MUST_JION);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 请求立即完成任务
	 */
	public void sendActivityCompleteTask()
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_ACTIVITY_COMPLETE_TASK,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_ACTIVITY_COMPLETE_TASK);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 确认立即完成任务
	 */
	public void sendActivityCompleteTaskOk(byte moneyType)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.write(moneyType);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_ACTIVITY_COMPLETE_TASK_OK,
							baos.toByteArray());
			Tools.debugPrintln("发送指令"
					+ GameProtocol.CS_ACTIVITY_COMPLETE_TASK_OK);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 请求更换任务
	 */
	public void sendActivityBuyTask()
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_ACTIVITY_BUY_TASK,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_ACTIVITY_BUY_TASK);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 确认购买任务
	 */
	public void sendActivityBuyTaskOk(byte moneyType)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(moneyType);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_ACTIVITY_BUY_TASK_OK,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_ACTIVITY_BUY_TASK_OK);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 获取排行列表
	 *
	 * @param currterPage
	 * @param number
	 */
	public void sendRankingList(byte type, short currterPage, short number)
	{
		if (isNetLocked(锁_排行)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeShort(currterPage);
			dos.writeShort(number);
			int value = -1;
			switch (type) {
				case UIRankWindow.等级:
					value = GameProtocol.CS_RANKINGLIST_LEVEL;
					Tools.debugPrintln("发送等级" + value + "排行榜成功");
					break;
				case UIRankWindow.家族:
					value = GameProtocol.CS_RANKINGLIST_FAMILY;
					Tools.debugPrintln("发送家族" + value + "排行榜成功");
					break;
				case UIRankWindow.财富:
					value = GameProtocol.CS_RANKINGLIST_WEALTH;
					Tools.debugPrintln("发送财富" + value + "排行榜成功");
					break;
				case UIRankWindow.击杀:
					value = GameProtocol.CS_RANKINGLIST_KILL;
					Tools.debugPrintln("发送击杀" + value + "排行榜成功");
					break;
				case UIRankWindow.贡献:
					value = GameProtocol.CS_RANKINGLIST_CONTRIBUTION;
					Tools.debugPrintln("发送贡献" + value + "排行榜成功");
					break;
				case UIRankWindow.战功:
					value = GameProtocol.CS_RANKINGLIST_MILITARY_EXPLOITS;
					Tools.debugPrintln("发送战功" + value + "排行榜成功");
					break;
				case UIRankWindow.社交:
					value = GameProtocol.CS_RANKINGLIST_SOCIAL_CONTACT;
					Tools.debugPrintln("发送社交" + value + "排行榜成功");
					break;
				case UIRankWindow.个人竞技:
					value = GameProtocol.CS_RANKINGLIST_INDIVIDUAL_SPORTS;
					Tools.debugPrintln("发送个人竞技" + value + "排行榜成功");
					break;
				case UIRankWindow.家族竞技:
					value = GameProtocol.CS_RANKINGLIST_FAMILY_SPORTS;
					Tools.debugPrintln("发送家族竞技" + value + "排行榜成功");
					break;
				case UIRankWindow.婚姻:
					value = GameProtocol.CS_RANKINGLIST_MARRIAGE;
					Tools.debugPrintln("发送婚姻" + value + "排行榜成功");
					break;
				case UIRankWindow.战力:
					value = GameProtocol.CS_RANKINGLIST_ZHANLI;
					Tools.debugPrintln("发送战力" + value + "排行榜成功");
					break;

			}
			if (value != -1) {
				DWGameManager
						.getInstance()
						.getConnection()
						.sendMessage(BaseConnection.DEST_UNIVERSE, 0, value,
								baos.toByteArray());
			}
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_排行);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	public void sendBuyItemInMulMoney(String actoritemKey, byte type_money,
			long price, int mBuyNum)
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(actoritemKey);
			dos.writeByte(type_money);
			dos.writeLong(price);
			dos.writeInt(mBuyNum);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_BUY_ITEM_WITH_MUL_MONEY,
							baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 赠送道具给某人 2012-5-3 下午07:15:00 venizeng
	 *
	 * @param id_actoritem
	 * @param type_money
	 * @param price_rmb
	 * @param mBuyNum
	 * @param mNameRecver
	 */
	public void sendItemToSbInMulMoney(String itemKey, byte type_money,
			long price_rmb, int mBuyNum, long id, String mNameRecver)
	{
		if (isNetLocked(锁_背包)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(itemKey);
			dos.writeByte(type_money);
			dos.writeLong(price_rmb);
			dos.writeInt(mBuyNum);
			dos.writeLong(id);
			dos.writeUTF(mNameRecver);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0,
							GameProtocol.CS_PRESENT_ITEM_WITH_MUL_MONEY,
							baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_背包);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 金钱购买功能实现 2012-5-3 下午07:07:20 venizeng
	 *
	 * @param id_actoritem
	 * @param type_money
	 * @param price_rmb
	 * @param mBuyNum
	 * @param mNameRecver
	 */
	public void sendBuyFunWithMoney(byte type_money, long price, int operType)
	{

		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(type_money);
			dos.writeLong(price);
			dos.writeInt(operType);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_BUY_FUN_WITH_MUL_MONEY,
							baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 2012-4-25 下午07:10:26 venizeng
	 */
	public void sendOpenMarket()
	{

		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_OPEN_MARKET,
							baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 2012-4-25 下午07:10:26 venizeng
	 */
	public void sendOpenChongzhi()
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_OPEN_CHONGZHI,
							baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	public void sendChongzhiMianer()
	{
		if (isNetLocked(锁_默认)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_CHONGZHI_MIANER,
							baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_默认);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	public void sendChongzhi(String yunyingshang, String mianer, String id,
			String pass, byte cardType)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			Tools.debugPrintln("进充值");
			dos.writeByte((byte) 0);
			dos.writeUTF(yunyingshang);
			dos.writeUTF(mianer);
			dos.writeUTF(id);
			dos.writeUTF(pass);
			dos.writeByte(cardType);
			Tools.debugPrintln("充值了=" + GameProtocol.CS_CHONGZHI_CONFIG);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_CHONGZHI_CONFIG,
							baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * sdk充值发送轮询
	 */
	public void sendChongzhiSDk()
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			Tools.debugPrintln("进充值");
			dos.writeByte((byte) 1);
			Tools.debugPrintln("充值了=" + GameProtocol.CS_CHONGZHI_CONFIG);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_CHONGZHI_CONFIG,
							baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 查看充值记录
	 */
	public void sendChongzhiRecord()
	{
		if (isNetLocked(锁_充值)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_QUERY_CHONGZHI,
							baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_充值);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

//	public void sendYuanbaoyuer()
//	{
//		if (isNetLocked(锁_充值)) {
//			return;
//		}
//		ByteArrayOutputStream baos = new ByteArrayOutputStream();
//		DataOutputStream dos = new DataOutputStream(baos);
//		try {
//			dos.write(1);
//			DWGameManager
//					.getInstance()
//					.getConnection()
//					.sendMessage(0, GameProtocol.CS_QUERY_CHONGZHI,
//							baos.toByteArray());
//			dos.close();
//			dos = null;
//			baos.close();
//			baos = null;
//			lockNetwork(锁_充值);
//		}
//		catch (IOException e) {
//			Tools.debug(e);
//		}
//	}

	/**
	 * 查看充值记录
	 */
	public void sendYuanbaoConsumeRecord()
	{
		if (isNetLocked(锁_充值)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_QUERY_YUANBAO_CONSUME,
							baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_充值);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 请求创建栏数据
	 *
	 * @param byte type 栏的类型（0角色背包栏1装备栏2仓库栏）
	 * */
	public void sendColumnCommand(byte type)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(type);
			int gameProtocolType = GameProtocol.CS_COLUMN_COMMAND;
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, gameProtocolType, baos.toByteArray());
			Tools.debugPrintln("发送创建栏请求数据!");
		}
		catch (IOException e) {
		}
		finally {
			try {
				dos.close();
			}
			catch (IOException e) {
			}
			dos = null;
			try {
				baos.close();
			}
			catch (IOException e) {
			}
			baos = null;
		}
	}

	/**
	 * 请求交换格子信息
	 *
	 * @param byte start_type 起始栏的类型（0角色背包栏1装备栏2仓库栏）
	 * @param int start_index 索引
	 * @param byte target_type 目标栏类型
	 * @param int target_index 索引
	 * */
	public void sendExchangeCellCommand(byte start_type, int start_index,
			byte target_type, int target_index)
	{
		if (isNetLocked(锁_背包)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			Item item = null;
			Role role = DWGameManager.getInstance().m_role;
			switch (start_type) {
				case Cell.TYPE_COLUMN_EQUIP:
					item = role.m_column_equip[start_index].m_item;
					break;
				case Cell.TYPE_COLUMN_ROLEBAG:
					item = role.m_column_bag[start_index].m_item;
					break;
				case Cell.TYPE_COLUMN_WAREHOUSE:
					item = role.m_column_warehouse[start_index].m_item;
					break;
			}
			if (item == null) {// 操作起始栏没有道具
				Tools.debugPrintln("发送交换格子指令时 起始栏内道具为空");
				return;
			}
			dos.writeByte(start_type);
			dos.writeShort(start_index);
			dos.writeByte(target_type);
			dos.writeShort(target_index);
			int gameProtocolType = GameProtocol.CS_EXCHANGECELL_COMMAND;
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, gameProtocolType, baos.toByteArray());
			Tools.debugPrintln("发送交换格子请求数据!");
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			// lockNetwork(锁_背包);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 请求合成宝石
	 *
	 * @param String
	 * key 宝石的KEY
	 * @param short num 数量
	 * */
	public void sendSynthesisGemCommand(String key, short num)
	{
		if (isNetLocked(锁_天工)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(key);
			dos.writeShort(num);
			int gameProtocolType = GameProtocol.CS_SYNTHESIS_GEM_COMMAND;
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, gameProtocolType, baos.toByteArray());
			Tools.debugPrintln("发送合成宝石!");
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_天工);
		}
		catch (IOException e) {
		}
	}

	/**
	 * 请求镶嵌宝石
	 *
	 * @param long guid 宝石的ID
	 * @param long guid 镶嵌的装备ID
	 * */
	public void sendSetGemCommand(long guid, long equip_guid)
	{
		if (isNetLocked(锁_天工)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(guid);
			dos.writeLong(equip_guid);
			int gameProtocolType = GameProtocol.CS_SET_GEM_COMMAND;
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, gameProtocolType, baos.toByteArray());
			Tools.debugPrintln("发送镶嵌宝石!");
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_天工);
		}
		catch (IOException e) {
		}
	}

	/**
	 * 请求整理栏
	 *
	 * @param byte type 栏的类型（0角色背包栏1装备栏2仓库栏）
	 * */
	public void sendArrangeMentColumnCommand(byte type)
	{
		if (isNetLocked(锁_背包)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(type);
			int gameProtocolType = GameProtocol.CS_ARRANGEMENT_COLUMN_COMMAND;
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, gameProtocolType, baos.toByteArray());
			Tools.debugPrintln("发送整理栏请求数据!");
			lockNetwork(锁_背包);
		}
		catch (IOException e) {
		}
		finally {
			try {
				dos.close();
			}
			catch (IOException e) {
			}
			dos = null;
			try {
				baos.close();
			}
			catch (IOException e) {
			}
			baos = null;
		}
	}

	/**
	 * 操作栏内菜单选项的通用方法
	 *
	 * @param int 指令号
	 * @param byte type 栏的类型（0角色背包栏1装备栏2仓库栏）
	 * @param int index 栏索引
	 * */
	public void sendOperaterCellMenuCommand(int gameProtocolType, byte type,
			int index)
	{
		switch (gameProtocolType) {
			case GameProtocol.操作菜单_装备:
			case GameProtocol.操作菜单_卸下:
			case GameProtocol.操作菜单_删除:
			case GameProtocol.操作菜单_扩充栏:
				if (isNetLocked(锁_背包)) {
					return;
				}
				break;
			case GameProtocol.操作菜单_使用:
				if (isNetLocked(锁_背包)) {
					return;
				}
				Role role = DWGameManager.getInstance().m_role;
				if (role != null) {
					if (!role.openItemCD(type, index)) {
						return;
					}
				}
				else {
					return;
				}
				break;
			case GameProtocol.操作装备_强化:
				if (isNetLocked(锁_天工)) {
					return;
				}
				break;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(type);
			dos.writeShort(index);
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, gameProtocolType, baos.toByteArray());
			Tools.debugPrintln("发送请求操作栏内菜单指定指令：" + gameProtocolType);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			switch (gameProtocolType) {
				case GameProtocol.操作菜单_装备:
				case GameProtocol.操作菜单_卸下:
				case GameProtocol.操作菜单_删除:
				case GameProtocol.操作菜单_扩充栏:
				case GameProtocol.操作菜单_使用:
					// lockNetwork(锁_背包);
					break;
				case GameProtocol.操作装备_强化:
					lockNetwork(锁_天工);
					break;
			}
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	// /////////////////////////////////内丹////////////////////////////////////
	/**
	 * 发送开启内丹界面
	 */
	public void sendNeiDangOpenWindow()
	{
		if (isNetLocked(锁_内丹)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_NEIDANG_OPENWIN,
							baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_内丹);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/***
	 * 发送服用内丹
	 *
	 * @param type
	 * @param level
	 * @param point
	 * 位置
	 */
	public void sendNeiDangEat(byte type, byte level)
	{
		if (isNetLocked(锁_内丹)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(type);
			dos.writeByte(level);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_NEIDANG_EAT,
							baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_内丹);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	// /////////////////////////////////////// 天命（祭天台）////////////////////////
	/**
	 * 获得天命背包数据
	 */
	public void sendTianMingGetBag()
	{
		// if (isNetLocked(锁_天命)) {
		// return;
		// }
		// lockNetwork(锁_天命);
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_TIANMING_BAG,
							baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送天命祭拜
	 */
	public void sendTianMingJiBai()
	{
		if (isNetLocked(锁_天命)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_TIANMING_JIBAI,
							baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_天命);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送全部收取
	 */
	public void sendTianMingShouQu()
	{
		if (isNetLocked(锁_天命)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_CLT_JTT_PUT_AWAY,
							baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_天命);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送装备天命
	 *
	 * @param bag
	 * @param zhuanbei
	 */
	public void sendTianMingZhuanbei(byte bag, byte zhuanbei)
	{
		if (isNetLocked(锁_天命)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(bag);
			dos.writeByte(zhuanbei);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_TIANMING_ZHUANBEI,
							baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_天命);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 合并天命
	 *
	 * @param bagA
	 * @param bagB
	 */
	public void sendTianMingHebing(byte bagA, byte bagB)
	{
		if (isNetLocked(锁_天命)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(bagA);
			dos.writeByte(bagB);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_TIANMING_HEBING,
							baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_天命);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送开启天命界面数据
	 */
	public void sendTianMingData()
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_TIANMING_OPEN,
							baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 注入天命
	 *
	 * @param guid
	 */
	public void sendTianMingZhuRu(long guid)
	{
		if (isNetLocked(锁_天命)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(guid);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_TIANMING_ZHURU,
							baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_天命);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 卸载天命
	 *
	 * @param guid
	 */
	public void sendTianMingUnLoad(long guid)
	{
		if (isNetLocked(锁_天命)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(guid);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_TIANMING_UNLOAD,
							baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_天命);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 天命 自动祭拜
	 *
	 * @param guid
	 */
	public void sendTianMingAutoJB()
	{
		if (isNetLocked(锁_天命)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.C_TIANMING_AUTOJB,
							baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_天命);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 天命 自动合并
	 *
	 * @param guid
	 */
	public void sendTianMingAutoHB()
	{
		if (isNetLocked(锁_天命)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.C_TIANMING_AUTOTS,
							baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_天命);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 扩天命背包
	 */
	public void sendTianMingKuoBeiBao(byte num)
	{
		if (isNetLocked(锁_天命)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(num);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_TIANMING_KUOBEIBAO,
							baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_天命);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	// ////////////////////////////////////宠物 //////////////////////////////////
	/**
	 * 开启宠物界面
	 */
	public void sendChongWuOpenWin()
	{
		if (isNetLocked(锁_宠物)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_CHONGWU_OPEN,
							baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_宠物);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 宠物改名
	 */
	public void sendChangePetName(long id, String name)
	{
		if (isNetLocked(锁_宠物)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			;
			dos.writeLong(id);
			dos.writeUTF(name);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_CHONGWU_CHANGENAME,
							baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_宠物);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 0 收回 1 出战
	 *
	 * @param state
	 * @param id
	 */
	public void sendChongWuChuZhan(byte state, long id)
	{
		if (isNetLocked(锁_宠物)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(state);
			dos.writeLong(id);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_CHONGWU_CHUZHAN,
							baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_宠物);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 扩宠物背包
	 */
	public void sendChongWuKuoBeiBao()
	{
		if (isNetLocked(锁_宠物)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_CHONGWU_KUOBEIBAO,
							baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_宠物);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送分解装备
	 */
	public void sendSmeltingEquip(Vector<Cell> list)
	{
		if (list == null || list.size() < 1) {
			return;
		}
		if (isNetLocked(锁_天工)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			short size = (short) list.size();
			dos.writeShort(size);
			for (int i = 0; i < size; i++) {
				Cell cell = (Cell) list.get(i);
				byte type = (byte) cell.m_column_type;
				short index = (short) cell.m_index;
				dos.writeByte(type);
				dos.writeShort(index);
			}
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_SMELTING_EQUIP,
							baos.toByteArray());
			Tools.debugPrintln("发送分解 个数=" + size);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_天工);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送查看下级宝石属性
	 */
	public void sendSeeNextLevelGem(String key)
	{
		if (key == null || key.equals("")) {
			return;
		}
		if (isNetLocked(锁_天工)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(key);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_SEE_NEXTLEVEL_GEM,
							baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_天工);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送分解装备
	 */
	public void sendSureToSmelting()
	{
		if (isNetLocked(锁_天工)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_SURE_TO_SMELTING,
							baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_天工);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送抽取精魂 获得数值
	 */
	public void sendExtractionSpiritNum(long guid)
	{
		if (isNetLocked(锁_天工)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(guid);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_EXTRACTION_SPIRIT_NUM,
							baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_天工);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送抽取精魂
	 */
	public void sendExtractionSpirit(long guid)
	{
		if (isNetLocked(锁_天工)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(guid);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_EXTRACTION_SPIRIT,
							baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_天工);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送取下宝石
	 *
	 * @param guid
	 * 装备ID
	 * @param index
	 * 取下宝石槽的索引
	 */
	public void sendDownGem(long guid, byte index)
	{
		if (isNetLocked(锁_天工)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			index += Attribute.力;
			dos.writeLong(guid);
			dos.writeByte(index);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_DOWN_GEM,
							baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_天工);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送购买道具
	 *
	 * @param type
	 * 货币类型
	 * @param index
	 * 格子索引
	 * @param GemIndex
	 * 宝石槽索引
	 */
	public void sendShopBuyItem(byte sellType, String key, int num)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(sellType);
			dos.writeUTF(key);
			dos.writeInt(num);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_SHOP_BUY_ITEM,
							baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送活动排队
	 */
	public void sendARENAJOIN(byte type)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(type);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_ARENA_JOIN,
							baos.toByteArray());
			Tools.debugPrintln("发送活动排队：" + GameProtocol.CS_ARENA_JOIN);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 竞技场取消排队 1个人，２家族
	 *
	 * @param type
	 */
	public void sendARENAcancel(byte type)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(type);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.C_ARENA_CANCEL,
							baos.toByteArray());
			Tools.debugPrintln("发送取消排队：：" + GameProtocol.C_ARENA_CANCEL);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送查看道具详情况
	 *
	 * @param guid
	 * 道具唯一ID
	 * @param key
	 * 道具模版KEY
	 */
	public void sendSeeItemInfos(long guid, String key)
	{
		if (DWGameManager.getInstance().SeeItemInfos(key, guid)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			if (key == null) {
				key = "";
			}
			UIWindows.getInstance().m_bag.openNetItemMessage(key);
			dos.writeLong(guid);
			dos.writeUTF(key);
			Tools.debugPrintln("AAAAAAAAAAAAAAAAAAAAAAAAAAAA");
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_SEE_ITEM_INFOS,
							baos.toByteArray());
			Tools.debugPrintln("bbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
			//Tools.debugPrintln("发送查看道具详情况：" + GameProtocol.CS_SEE_ITEM_INFOS);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			Tools.debugPrintln("查看道具详情。" + GameProtocol.CS_SEE_ITEM_INFOS);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送查看下级强值
	 *
	 * @param type
	 * 格子类型
	 * @param index
	 * 格子索引
	 */
	public void sendStrengthenNextLevelValues(byte type, int index)
	{
		// if (isNetLocked(锁_天工)) {
		// return;
		// }
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(type);
			dos.writeShort((short) index);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0,
							GameProtocol.CS_STRENGTHEN_NEXTLEVEL_VALUES,
							baos.toByteArray());
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			// lockNetwork(锁_天工);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送是否进入竞技场 1.个人，2家族，5阵营战场
	 */
	public void sendARENREQUEST(byte state, byte type, long id)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(state);
			dos.writeByte(type);
			dos.writeLong(id);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_ARENA_REQUEST,
							baos.toByteArray());
			Tools.debugPrintln("发送进入竞技场：：" + GameProtocol.CS_ARENA_REQUEST);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 查看其它角色信息
	 *
	 * @param id
	 * 角色的gameId
	 */
	public void sendSeeOtherRoleInfo(long id)
	{
		if (isNetLocked(锁_人物信息)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(id);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(BaseConnection.DEST_GATEWAY, 0, GameProtocol.CS_ROLE_INFO,
							baos.toByteArray());
			Tools.debugPrintln("查看其它角色信息：：" + GameProtocol.CS_ROLE_INFO);

			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_人物信息);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 回城复活
	 */
	public void sendReliveRoleBackCity()
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_REVIVE_AGREE,
							baos.toByteArray());
			Tools.debugPrintln("回城复活：" + GameProtocol.CS_REVIVE_AGREE);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 原地复活
	 */
	public void sendReliveRole()
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_REVIVE_POS,
							baos.toByteArray());
			Tools.debugPrintln("原地复活：" + GameProtocol.CS_REVIVE_POS);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	// ////////////////////////////////////////////////////
	//
	// ////////////////////////////////////////////////////
	/**
	 * 发送定时活动开启
	 */
	public void sendAssistantActivityOpen()
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_ASSISTANT_ACTIVITY_OPEN,
							baos.toByteArray());
			Tools.debugPrintln("发送定时活动界面开启 : "
					+ GameProtocol.CS_ASSISTANT_ACTIVITY_OPEN);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送定时活动还可参加次数
	 */
	public void sendAssistantActivityCount()
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_ASSISTANT_ACTIVITY_COUNT,
							baos.toByteArray());
			Tools.debugPrintln("发送定时活动还可参加次数 : "
					+ GameProtocol.CS_ASSISTANT_ACTIVITY_COUNT);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送日常活动开启
	 */
	public void sendAssistantEverydayOpen()
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_ASSISTANT_EVERYDAY_OPEN,
							baos.toByteArray());
			Tools.debugPrintln("发送日常活动界面开启 : "
					+ GameProtocol.CS_ASSISTANT_EVERYDAY_OPEN);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送日常活动开启
	 */
	public void sendGameCarbonBuy()
	{

		if (isNetLocked(锁_副本)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_GAMECARBON_BUY,
							baos.toByteArray());
			Tools.debugPrintln("发送购买精力指令: "
					+ GameProtocol.CS_GAMECARBON_BUY);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_副本);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送购买buff
	 */
	public void sendBuyBuff()
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_FAMILY_CARBON_DWPR,
							baos.toByteArray());
			Tools.debugPrintln("发送购买buff : "
					+ GameProtocol.CS_FAMILY_CARBON_DWPR);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送运营活动开启
	 */
	public void sendAssistantOperateOpen()
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_ASSISTANT_OPERATE_OPEN,
							baos.toByteArray());
			Tools.debugPrintln("发送运营活动界面开启 : "
					+ GameProtocol.CS_ASSISTANT_OPERATE_OPEN);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送运营活动选项
	 */
	public void sendAssistantOperateSend(String key, byte funcType,
			String parameter)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			if (key == null || parameter == null) {
				return;
			}
			dos.writeUTF(key);
			dos.writeByte(funcType);
			dos.writeUTF(parameter);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_ASSISTANT_OPERATE_SEND,
							baos.toByteArray());
			Tools.debugPrintln("发送运营活动选项 : "
					+ GameProtocol.CS_ASSISTANT_OPERATE_SEND);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 修理装备栏装备
	 */
	public void sendFixEquips()
	{
		if (isNetLocked(锁_修理)) {
			return;
		}

		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(Cell.INDEX_ROLEBAG_EQUIP);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_NPC_FIX_EQUIPS,
							baos.toByteArray());
			Tools.debugPrintln("修理装备栏装备 : " + GameProtocol.CS_NPC_FIX_EQUIPS);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_修理);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 修理所有装备
	 */
	public void sendFixAll()
	{
		if (isNetLocked(锁_修理)) {
			return;
		}

		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_NPC_FIX_ALL,
							baos.toByteArray());
			Tools.debugPrintln("修理所有装备 : " + GameProtocol.CS_NPC_FIX_ALL);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_修理);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 修理所有装备
	 */
	public void sendAutoFixAllForVIP()
	{
		if (isNetLocked(锁_修理)) {
			return;
		}

		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_VIP_AUTOREPAIRE_EQUIP,
							baos.toByteArray());
			Tools.debugPrintln("VIP自动修理所有装备 : " + GameProtocol.CS_VIP_AUTOREPAIRE_EQUIP);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_修理);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送请求开启vip商城界面
	 */
	public void sendOpenVipShop(byte type, byte open)
	{
		if (isNetLocked(锁_道具商城)) {
			return;
		}

		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(type);
			dos.writeByte(open);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_VIPSHOP_OPEN,
							baos.toByteArray());
			Tools.debugPrintln("请求打开vip商城 : " + GameProtocol.CS_VIPSHOP_OPEN);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_道具商城);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送购买
	 */
	public void sendVipShopBuy(String key, byte num)
	{
		// if(isNetLocked(锁_道具商城)){
		// return;
		// }
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(key);
			dos.writeByte(num);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_VIPSHOP_BUY,
							baos.toByteArray());
			Tools.debugPrintln("请求购买 : " + GameProtocol.CS_VIPSHOP_BUY);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			// lockNetwork(锁_道具商城);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	public void sendLookVipShopItem(String key)
	{
		if (isNetLocked(锁_道具商城)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(key);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_VIPSHOP_ITEM,
							baos.toByteArray());
			Tools.debugPrintln("请求查看item : " + GameProtocol.CS_VIPSHOP_ITEM);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_道具商城);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送请求打开VIP界面
	 */
	public void sendOpenVip()
	{
		if (isNetLocked(锁_VIP特权)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_VIP_OPEN,
							baos.toByteArray());
			Tools.debugPrintln("请求打开vip界面 : " + GameProtocol.CS_VIP_OPEN);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_VIP特权);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送请求vip等级描述
	 */
	public void sendOpenVipLevel(byte level)
	{
		if (isNetLocked(锁_VIP特权)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(level);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_VIP_LEVEL,
							baos.toByteArray());
			Tools.debugPrintln("请求vip等级描述 : " + GameProtocol.CS_VIP_LEVEL);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_VIP特权);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 领取礼包指令
	 */
	public void sendGetLiBao(byte level)
	{

		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(level);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_LIBAO_OPEN,
							baos.toByteArray());
			Tools.debugPrintln("请求领取礼包指令 : " + GameProtocol.CS_LIBAO_OPEN);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送请求查看充值记录
	 */
	public void sendOpenChongZhiJiLu()
	{
		if (isNetLocked(锁_充值)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_GET_CHONGZHIJILU,
							baos.toByteArray());
			Tools.debugPrintln("请求查看充值记录 : " + GameProtocol.CS_GET_CHONGZHIJILU);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_充值);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 请求打开交易界面
	 *
	 * @param GAMEID
	 * 交易目标ID
	 */
	public void sendTranActionOpen(long gameID)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(gameID);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_TRANSACTION_OPEN,
							baos.toByteArray());
			Tools.debugPrintln("请求打开交易界面 : " + GameProtocol.CS_TRANSACTION_OPEN);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 锁自己交易的物品
	 *
	 * @param byte isClock 0解锁 1锁
	 */
	public void sendTranActionClockMine(byte isClock)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(isClock);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_TRANSACTION_CLOCK_MINE,
							baos.toByteArray());
			Tools.debugPrintln("锁自己交易的物品 : "
					+ GameProtocol.CS_TRANSACTION_CLOCK_MINE);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 放弃交易
	 *
	 * @param GAMEID
	 * 交易目标ID
	 */
	public void sendTranActionGiveUp(long gameID)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(gameID);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_TRANSACTION_GIVE_UP,
							baos.toByteArray());
			Tools.debugPrintln("放弃交易 : " + GameProtocol.CS_TRANSACTION_GIVE_UP);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 确定交易
	 *
	 * @param GAMEID
	 * 交易目标ID
	 * @param MONEY
	 * @param LIST
	 * 交易物品的列表
	 */
	public void sendTranActionComFirm(long gameID, Long money,
			CopyOnWriteArrayList<Cell> list)
	{
		int size = list.size();
		if (money < 0) {
			money = (long) 0;
		}

		if (size < 0) {
			size = 0;
		}
//		if (money < 0 && size < 1) {
//			return;
//		}

		ByteArrayOutputStream baos = new ByteArrayOutputStream();//TODO
		DataOutputStream dos = new DataOutputStream(baos);
		CopyOnWriteArrayList<Long> guidlist = new CopyOnWriteArrayList<Long>();
		CopyOnWriteArrayList<Integer> numlist = new CopyOnWriteArrayList<Integer>();
		try {
			dos.writeLong(gameID);
			dos.writeLong(money);
			if (size > 0) {
				for (Cell cell : list) {
					if (cell != null && cell.m_item != null
							&& cell.m_item.m_num > 0) {
						guidlist.add(cell.m_item.m_guid);
						numlist.add(cell.m_item.m_num);
					}
				}
				size = guidlist.size();
			}
			dos.writeByte(size);
			long guid = 0;
			int num = 0;
			for (int i = 0; i < size; i++) {
				guid = guidlist.get(i);
				num = numlist.get(i);
				dos.writeLong(guid);
				dos.writeInt(num);
			}
			guidlist = null;
			numlist = null;
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_TRANSACTION_COMFIRM,
							baos.toByteArray());
			Tools.debugPrintln("确定交易 : " + GameProtocol.CS_TRANSACTION_COMFIRM);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 自己交易物品列表
	 *
	 * @param MONEY
	 * @param LIST
	 * 交易物品的列表
	 */
	public void sendTranActionOwnList(Long money,
			CopyOnWriteArrayList<Cell> list)
	{
		int size = list.size();
		if (money < 0) {
			money = (long) 0;
		}
		if (size < 0) {
			size = 0;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		CopyOnWriteArrayList<Long> guidlist = new CopyOnWriteArrayList<Long>();
		CopyOnWriteArrayList<Integer> numlist = new CopyOnWriteArrayList<Integer>();
		CopyOnWriteArrayList<Integer> indexlist = new CopyOnWriteArrayList<Integer>();
		try {
			dos.writeLong(money);
			if (size > 0) {
				for (Cell cell : list) {
					if (cell != null && cell.m_item != null
							&& cell.m_item.m_num > 0) {
						indexlist.add(cell.m_index);
						guidlist.add(cell.m_item.m_guid);
						numlist.add(cell.m_item.m_num);
					}
				}
				size = guidlist.size();
			}
			dos.writeByte(size);
			long guid = 0;
			int num = 0;
			int index = 0;
			for (int i = 0; i < size; i++) {
				guid = guidlist.get(i);
				num = numlist.get(i);
				index = indexlist.get(i);
				dos.writeInt(index);
				dos.writeLong(guid);
				dos.writeInt(num);
			}
			guidlist = null;
			numlist = null;
			indexlist = null;
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_TRANSACTION_OWNLIST,
							baos.toByteArray());
			Tools.debugPrintln("自己交易物品列表 : "
					+ GameProtocol.CS_TRANSACTION_OWNLIST);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 确认与自己请求交易的结果
	 *
	 * @param GAMEID
	 * 交易目标ID
	 */
	public void sendTranActionComFirmRequest(long gameID, byte state)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(gameID);
			dos.writeByte(state);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_TRANSACTION_COMFIRM_REQUEST,
							baos.toByteArray());
			Tools.debugPrintln("确认与自己请求交易的结果 : " + GameProtocol.CS_TRANSACTION_COMFIRM_REQUEST);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 提交求婚申请
	 * @param name 求婚对象名称
	 *
	 */
	public void sendProposeApplication(String name)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(name);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_MARRIAGE_PROPOSE_APPLICATION,
							baos.toByteArray());
			Tools.debugPrintln("提交求婚申请: " + GameProtocol.CS_MARRIAGE_PROPOSE_APPLICATION);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 求婚确认
	 * @param state 求婚确认0拒绝1同意
	 */
	public void sendProposeConfirm(byte state, long gameID)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(state);
			dos.writeLong(gameID);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_MARRIAGE_PROPOSE_CONFIRM,
							baos.toByteArray());
			Tools.debugPrintln("求婚确认 : " + GameProtocol.CS_MARRIAGE_PROPOSE_CONFIRM);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 离婚申请
	 */
	public void sendDivorceApplication()
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_MARRIAGE_DIVORCE_APPLICATION,
							baos.toByteArray());
			Tools.debugPrintln("离婚申请 : " + GameProtocol.CS_MARRIAGE_DIVORCE_APPLICATION);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 离婚确定
	 */
	public void sendDivorceConfirm(byte state)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(state);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_MARRIAGE_DIVORCE_CONFIRM,
							baos.toByteArray());
			Tools.debugPrintln("离婚确定 : " + GameProtocol.CS_MARRIAGE_DIVORCE_CONFIRM);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 夫妻传送
	 */
	public void sendDivorceTransfer()
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_MARRIAGE_TRANSFER,
							baos.toByteArray());
			Tools.debugPrintln("夫妻传送 : " + GameProtocol.CS_MARRIAGE_TRANSFER);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送领奖信息
	 */
	public void sendPrizeMessage()
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, GameProtocol.CS_PRIZE_MESSAGE,
							baos.toByteArray());
			Tools.debugPrintln("发送领奖信息 : " + GameProtocol.CS_PRIZE_MESSAGE);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送领奖列表
	 */
	public void sendPrizeList()
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, GameProtocol.CS_PRIZE_LIST,
							baos.toByteArray());
			Tools.debugPrintln("发送领奖列表 : " + GameProtocol.CS_PRIZE_LIST);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送领奖
	 */
	public void sendPrizeApply(String key)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(key);
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, GameProtocol.CS_PRIZE_APPLY,
							baos.toByteArray());
			Tools.debugPrintln("发送领奖 : " + GameProtocol.CS_PRIZE_APPLY);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 请求打开师徒界面
	 */
	public void sendBaiShiOpen()
	{
		if (isNetLocked(锁_师徒)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0,
							GameProtocol.CS_TEACHERPUPIL_OPEN,
							baos.toByteArray());
			Tools.debugPrintln("拜师, 指令号 : " + GameProtocol.CS_TEACHERPUPIL_OPEN);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_师徒);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送请求拜师
	 *
	 * @param type
	 * @param m_id_int
	 */
	public void sendBaiShi(long teacher)
	{
		if (isNetLocked(锁_师徒)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(teacher);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0,
							GameProtocol.CS_TEACHERPUPIL_BAISHI,
							baos.toByteArray());
			Tools.debugPrintln("拜师类型 对方gameid:" + teacher + ", 指令号 : " + GameProtocol.CS_SOCIAL_NAME_ADD);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_师徒);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送师父决定
	 *
	 * @param type
	 * @param m_id_int
	 */
	public void sendBaiShiJueDing(long pupil, byte staus)
	{
//		 if(isNetLocked(锁_师徒)){
//			 return;
//		 }
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(pupil);
			dos.writeByte(staus);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0,
							GameProtocol.CS_TEACHERPUPIL_JIESHOU,
							baos.toByteArray());
			Tools.debugPrintln("拜师类型 对方gameid:" + pupil + ", 指令号 : " + GameProtocol.CS_TEACHERPUPIL_JIESHOU);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
//			lockNetwork(锁_师徒);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 通用 1 判处师门 2 学艺之路 3 桃李天下4.踢出师门
	 *
	 * @param type
	 * @param m_id_int
	 */
	public void sendBaiShiTongYong(byte staus, String name)
	{
		if (isNetLocked(锁_师徒)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {

			dos.writeByte(staus);
			if (staus == UISocial.TICHU) {
				dos.writeUTF(name);
			}
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0,
							GameProtocol.CS_TEACHERPUPIL_TONGYONG,
							baos.toByteArray());
			Tools.debugPrintln("拜师类型 对方gameid:, 指令号 : " + GameProtocol.CS_TEACHERPUPIL_TONGYONG);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_师徒);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 传功请求
	 * @param name
	 */
	public void sendChuanGongQingQiu(String name)
	{
		if (isNetLocked(锁_师徒)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeUTF(name);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0,
							GameProtocol.CS_TEACHERPUPIL_CHUANGONG,
							baos.toByteArray());
			Tools.debugPrintln("拜师类型 对方gameid:, 指令号 : " + GameProtocol.CS_TEACHERPUPIL_CHUANGONG);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_师徒);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 传功应答
	 * @param name
	 */
	public void sendChuanGongYingDa(long guid, byte staus)
	{
		if (isNetLocked(锁_师徒)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(guid);
			dos.writeByte(staus);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0,
							GameProtocol.CS_TEACHERPUPIL_CHUANGONGYINGDA,
							baos.toByteArray());
			Tools.debugPrintln("拜师类型 对方gameid:, 指令号 : " + GameProtocol.CS_TEACHERPUPIL_CHUANGONGYINGDA);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_师徒);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送传功已经结束
	 * @param name
	 */
	public void sendChuanGongJieSu(long guid)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(guid);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0,
							GameProtocol.CS_TEACHERPUPIL_CHUANGONGJINDUTIAO,
							baos.toByteArray());
			Tools.debugPrintln("拜师类型 对方gameid:, 指令号 : " + GameProtocol.CS_TEACHERPUPIL_CHUANGONGYINGDA);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送可购买帮贡60026
	 */
	public void sendHelpBuy(int count)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeInt(count);
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, GameProtocol.CS_HELP_GONG_BUY,
							baos.toByteArray());
			Tools.debugPrintln("发送 : " + GameProtocol.CS_HELP_GONG_BUY);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送购买帮贡60025
	 */
	public void sendHelpCount()
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, GameProtocol.CS_HELP_GONG_COUNT,
							baos.toByteArray());
			Tools.debugPrintln("发送 : " + GameProtocol.CS_HELP_GONG_COUNT);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 捐献帮贡60060
	 */
	public void sendJuanXianBangGong(byte state,long num)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(state);
			dos.writeLong(num);
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, GameProtocol.CS_HELP_GONG_JUANXIAN,
							baos.toByteArray());
			Tools.debugPrintln("发送 : " + GameProtocol.CS_HELP_GONG_JUANXIAN);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送家族开启技能
	 */
	public void sendOpenFamilySkill(byte state,String key)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(state);
			dos.writeUTF(key);
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, GameProtocol.CS_FAMILY_STUDYSKILL,
							baos.toByteArray());
			Tools.debugPrintln("发送 : " + GameProtocol.CS_FAMILY_STUDYSKILL);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送可购买个人竞技次数60027
	 */
	public void sendAddBuy(byte count)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(count);
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, GameProtocol.CS_ADD_BUY,
							baos.toByteArray());
			Tools.debugPrintln("发送 : " + GameProtocol.CS_ADD_BUY);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送购买个人竞技60028
	 */
	public void sendAddCount()
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, GameProtocol.CS_ADD_COUNT,
							baos.toByteArray());
			Tools.debugPrintln("发送 : " + GameProtocol.CS_ADD_COUNT);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送可购买每日任务次数60029
	 */
	public void sendAddEverydayBuy(byte count)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(count);
			Tools.debugPrintln("count:"+count);
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, GameProtocol.CS_ADD_EVERYDAY_BUY,
							baos.toByteArray());
			Tools.debugPrintln("发送 : " + GameProtocol.CS_ADD_EVERYDAY_BUY);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送每日任务进度与次数指令
	 */
	public void sendEveryday()
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, GameProtocol.CS_EVERYDAY_JINDU,
							baos.toByteArray());
			Tools.debugPrintln("发送 : " + GameProtocol.CS_EVERYDAY_JINDU);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送八卦炉指令60050
	 */
	public void sendBaGuaLu(byte count, byte type, int add, CopyOnWriteArrayList<Cell> list)
	{
		if (isNetLocked(锁_八卦炉)) {
			return;
		}
		int m_size = list.size();
		if (m_size < 0) {
			m_size = 0;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		Vector<Long> guidlist = new Vector<Long>();
		try {
			switch (count) {
				case 1:
					dos.writeByte(count);
					break;
				case 2:
					dos.writeByte(count);
					dos.writeByte(type);
					dos.writeInt(add);
					dos.writeByte(m_size);
					if (m_size > 0) {
						for (Cell cell : list) {
							if (cell != null && cell.m_item != null
									&& cell.m_item.m_num > 0) {
								guidlist.add(cell.m_item.m_guid);
							}
						}
						m_size = guidlist.size();
					}
					long guid = 0;
					for (int i = 0; i < m_size; i++) {
						guid = guidlist.get(i);
						dos.writeLong(guid);
					}
					guidlist = null;
					break;
			}
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, GameProtocol.CS_BAGUALU_WD_CLT,
							baos.toByteArray());
			Tools.debugPrintln("发送 : " + GameProtocol.CS_BAGUALU_WD_CLT);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_八卦炉);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/***
	 * 请求打开指定魂页
	 * @param page
	 */
	public void sendOpenSoulByIndex(byte page)
	{
		if (isNetLocked(锁_炼魂)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(page);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_OPEN_SOUL_BY_INDEX,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_OPEN_SOUL_BY_INDEX);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_炼魂);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/***
	 * 请求查看指定魂页中的某个等级魂点
	 * @param page
	 * @param index
	 */
	public void sendSeeSoulByIndex(Soul soul)
	{
		if (isNetLocked(锁_炼魂)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			byte page = (byte) soul.m_page;
			short index = (short) (soul.m_index + 1);
			dos.writeByte(page);
			dos.writeShort(index);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_SEE_SOUL_BY_INDEX,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_SEE_SOUL_BY_INDEX);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_炼魂);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/***
	 * 请求 升级魂点
	 * @param page
	 * @param index
	 * @param type
	 */
	public void sendPromoteSoulLevel(byte page, int index, byte type, short ceng)
	{
		if (isNetLocked(锁_炼魂)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(page);
			dos.writeShort(index + 1);
			dos.writeByte(type);
			dos.writeShort(ceng);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_PROMOTE_SOUL_LEVEL,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_PROMOTE_SOUL_LEVEL);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_炼魂);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 塔式副本
	 * @param page
	 */

	/**
	 * 开启副本
	 */
	public void sendOpenTowerGamecarbon()
	{
		if (isNetLocked(锁_塔式副本)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_TOWER_GAMECARBON_OPEN,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_TOWER_GAMECARBON_OPEN);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_塔式副本);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 查看每层的奖励
	 * @param index
	 */
	public void sendTowerGamecarbonJiang(byte index)
	{
		if (isNetLocked(锁_塔式副本)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(index);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_TOWER_GAMECARBON_JIANG,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_TOWER_GAMECARBON_JIANG);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_塔式副本);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 锁定buff
	 * @param index
	 */
	public void sendTowerBuff(byte index)
	{
		if (isNetLocked(锁_塔式副本)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeByte(index);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_TOWER_ZHUANPAN_SUODING,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_TOWER_ZHUANPAN_SUODING);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_塔式副本);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 进入副本
	 */
	public void sendTowerGamecarbonJoin()
	{
		if (isNetLocked(锁_塔式副本)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager.getInstance().getConnection().sendMessage(0, GameProtocol.CS_TOWER_GAMECARBON_JOIN,
					baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_TOWER_GAMECARBON_JOIN);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_塔式副本);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 转盘开始旋转
	 */
	public void sendTowerZhuanpanBegin()
	{
		if (isNetLocked(锁_塔式副本)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager.getInstance().getConnection().sendMessage(0, GameProtocol.CS_TOWER_ZHUANPAN_BEGIN,
					baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_TOWER_ZHUANPAN_BEGIN);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_塔式副本);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 开始打怪
	 */
	public void sendTowerBeginDaGuai()
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager.getInstance().getConnection().sendMessage(0, GameProtocol.CS_TOWER_BEGIN_KAISHI,
					baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_TOWER_BEGIN_KAISHI);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 请求下一层的信息
	 */
	public void sendTowerNextInformation()
	{
		if (isNetLocked(锁_塔式副本)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager.getInstance().getConnection().sendMessage(0, GameProtocol.CS_TOWER_XIAYICENG_INFORMATION,
					baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_TOWER_XIAYICENG_INFORMATION);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_塔式副本);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 请求进入下一层的副本
	 */
	public void sendTowerJoinNextCeng()
	{
		if (isNetLocked(锁_塔式副本)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager.getInstance().getConnection().sendMessage(0, GameProtocol.CS_TOWER_JOIN_NEXTCENG,
					baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_TOWER_JOIN_NEXTCENG);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_塔式副本);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 请求离开副本
	 */
	public void sendTowerLeaveGameCarbon()
	{
		if (isNetLocked(锁_塔式副本)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager.getInstance().getConnection().sendMessage(0, GameProtocol.CS_TOWER_LEAVE_GAMECARBON,
					baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_TOWER_LEAVE_GAMECARBON);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_塔式副本);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 重置副本
	 */
	public void sendTowerMoreGameCarbon()
	{
		if (isNetLocked(锁_塔式副本)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager.getInstance().getConnection().sendMessage(0, GameProtocol.CS_TOWER_MORE_GAMECARBON,
					baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_TOWER_MORE_GAMECARBON);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_塔式副本);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 修罗杀场
	 */
	/**
	 * 进入战场
	 * @param key
	 */
	public void sendShuraBattleJoin(long key)
	{
		if (isNetLocked(锁_修罗杀场)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(key);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_SHURA_BATTLE_JOIN,
							baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_SHURA_BATTLE_JOIN);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_修罗杀场);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 右侧的即时分数
	 */
	public void sendJiShiScore()
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager.getInstance().getConnection().sendMessage(0, GameProtocol.CS_BG_SCORE, baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_BG_SCORE);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 中途离开
	 */
	public void sendZhongTuiLeave()
	{
		if (isNetLocked(锁_修罗杀场)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager.getInstance().getConnection().sendMessage(0, GameProtocol.CS_ZHONGTU_LEAVE,
					baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_ZHONGTU_LEAVE);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_修罗杀场);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 手动的最后离开战场
	 */
	public void sendShuraBattleLeave()
	{
		if (isNetLocked(锁_修罗杀场)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager.getInstance().getConnection().sendMessage(0, GameProtocol.CS_LEAVE, baos.toByteArray());
			Tools.debugPrintln("发送指令" + GameProtocol.CS_LEAVE);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_修罗杀场);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 重置技能
	 * @param protocol 指令号
	 */
	public void sendRestSkill(int protocol)
	{
		if (isNetLocked(锁_技能)) {
			return;
		}

		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.write(protocol);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, protocol, baos.toByteArray());
			Tools.debugPrintln("发送重置技能指令" + protocol);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_技能);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 开始抽奖
	 *
	 */
	public void sendLuckDrawStart()
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {

			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_LUCKDRAW_START, baos.toByteArray());
			Tools.debugPrintln("开始抽奖" + GameProtocol.CS_LUCKDRAW_START);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 抽奖增次
	 * @param addnum 增加次数
	 */
	public void sendLuckDrawAdd(byte addnum)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.write(addnum);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_LUCKDRAW_ADDNUM, baos.toByteArray());
			Tools.debugPrintln("抽奖增次" + GameProtocol.CS_LUCKDRAW_ADDNUM);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 请求抽奖结果
	 */
	public void sendLuckDrawGetResule()
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_LUCKDRAW_RESULT, baos.toByteArray());
			Tools.debugPrintln("请求抽奖结果" + GameProtocol.CS_LUCKDRAW_RESULT);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 发送刷新token
	 * @param text
	 */
	public void sendUSERFINSH(String text)
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(DWGameManager.getInstance().m_role.m_gameId);
			dos.writeUTF(text);
			DWGameManager.getInstance().getConnection()
					.sendMessage(0, GameProtocol.C_USER_REFERSH, baos.toByteArray());
			Tools.debugPrintln("发送刷新token指令" + GameProtocol.C_USER_REFERSH);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}

	}

	/**
	 * 推荐好友
	 */
	public void sendTuijianHaoyou()
	{
		if (isNetLocked(锁_推荐)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {

			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_TUIJIAN_HAOYOU, baos.toByteArray());
			Tools.debugPrintln("推荐好友" + GameProtocol.CS_TUIJIAN_HAOYOU);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_推荐);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 推荐徒弟
	 */
	public void sendTuijianTudi()
	{
		if (isNetLocked(锁_推荐)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {

			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_TUIJIAN_TUDI, baos.toByteArray());
			Tools.debugPrintln("推荐徒弟" + GameProtocol.CS_TUIJIAN_TUDI);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_推荐);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 推荐师傅
	 */
	public void sendTuijianShifu()
	{
		if (isNetLocked(锁_推荐)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {

			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_TUIJIAN_SHIFU, baos.toByteArray());
			Tools.debugPrintln("推荐师傅" + GameProtocol.CS_TUIJIAN_SHIFU);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_推荐);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 请求首充领奖详情
	 */
	public void sendFirstRechargeInfo()
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_RECHARGE_PRIZE, baos.toByteArray());
			Tools.debugPrintln("请求首充领奖详情" + GameProtocol.CS_RECHARGE_PRIZE);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 装备锻造
	 */
	public void sendEquipmentForge(long guid, byte index)
	{
		if (isNetLocked(锁_天工)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(guid);
			dos.writeByte(index);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_EQUIPMENT_FORGE, baos.toByteArray());
			Tools.debugPrintln("装备锻造" + GameProtocol.CS_EQUIPMENT_FORGE);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_天工);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}

	/**
	 * 使用装备锻造升级券
	 */
	public void sendEquipmentQuan(long guid, long guid1)
	{
		if (isNetLocked(锁_天工)) {
			return;
		}
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(baos);
		try {
			dos.writeLong(guid);
			dos.writeLong(guid1);
			DWGameManager
					.getInstance()
					.getConnection()
					.sendMessage(0, GameProtocol.CS_EQUIPMENT_QUAN, baos.toByteArray());
			Tools.debugPrintln("装备锻造" + GameProtocol.CS_EQUIPMENT_QUAN);
			dos.close();
			dos = null;
			baos.close();
			baos = null;
			lockNetwork(锁_天工);
		}
		catch (IOException e) {
			Tools.debug(e);
		}
	}
}
